Skip to content

Commit 64f0f08

Browse files
committed
🚧 adding classification and taxonomy entities
1 parent af46ef3 commit 64f0f08

3 files changed

Lines changed: 76 additions & 0 deletions

File tree

src/Entities/Classification.php

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?php
2+
3+
namespace TapestryCloud\Database\Entities;
4+
5+
/**
6+
* @Entity
7+
* @Table(name="classifications")
8+
*/
9+
class Classification
10+
{
11+
/** @Id @Column(type="integer") @GeneratedValue */
12+
private $id;
13+
14+
/** @Column(type="string") */
15+
private $name;
16+
17+
/** @ManyToOne(targetEntity="Taxonomy") */
18+
private $taxonomy;
19+
20+
/**
21+
* @ManyToMany(targetEntity="Classification")
22+
* @JoinTable(name="files_classifications",
23+
* joinColumns={@JoinColumn(name="file_id", referencedColumnName="id")},
24+
* inverseJoinColumns={@JoinColumn(name="classification_id", referencedColumnName="id")}
25+
* )
26+
*/
27+
private $files;
28+
29+
/**
30+
* @return string
31+
*/
32+
public function getName()
33+
{
34+
return $this->name;
35+
}
36+
37+
public function setName($name)
38+
{
39+
$this->name = $name;
40+
}
41+
}

src/Entities/ContentType.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ class ContentType
2929
/** @Column(type="boolean") */
3030
private $enabled;
3131

32+
/** @OnetoMany(targetEntity="Taxonomy", mappedBy="content_type_id") */
33+
private $taxonomy;
34+
3235
/**
3336
* @return string
3437
*/

src/Entities/Taxonomy.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
namespace TapestryCloud\Database\Entities;
4+
5+
/**
6+
* @Entity
7+
* @Table(name="taxonomies")
8+
*/
9+
class Taxonomy
10+
{
11+
/** @Id @Column(type="integer") @GeneratedValue */
12+
private $id;
13+
14+
/** @Column(type="string") */
15+
private $name;
16+
17+
/** @OnetoMany(targetEntity="Classification", mappedBy="taxonomy_id") */
18+
private $classifications;
19+
20+
/**
21+
* @return string
22+
*/
23+
public function getName()
24+
{
25+
return $this->name;
26+
}
27+
28+
public function setName($name)
29+
{
30+
$this->name = $name;
31+
}
32+
}

0 commit comments

Comments
 (0)