equal
deleted
inserted
replaced
1 <?php |
1 <?php |
2 |
2 |
3 namespace Company\BaseBundle\Entity; |
3 namespace Company\BaseBundle\Entity; |
4 |
4 |
5 use Doctrine\ORM\Mapping as ORM; |
5 use Doctrine\ORM\Mapping as ORM; |
6 use IRI\Bundle\WikiTagBundle\Model\DocumentInterface; |
6 use Doctrine\Common\Collections\ArrayCollection; |
7 |
7 |
8 /** |
8 /** |
9 * Company\BaseBundle\Entity\Document |
9 * Company\BaseBundle\Entity\Document |
10 * |
10 * |
11 * @ORM\Table() |
11 * @ORM\Table() |
34 * @var text $description |
34 * @var text $description |
35 * |
35 * |
36 * @ORM\Column(name="description", type="text") |
36 * @ORM\Column(name="description", type="text") |
37 */ |
37 */ |
38 private $description; |
38 private $description; |
|
39 |
|
40 /** |
|
41 * @ORM\ManyToMany(targetEntity="Category") |
|
42 * @ORM\JoinTable(name="documents_categories", |
|
43 * joinColumns={@ORM\JoinColumn(name="document_id", referencedColumnName="id")}, |
|
44 * inverseJoinColumns={@ORM\JoinColumn(name="category_id", referencedColumnName="id")} |
|
45 * ) |
|
46 * @ORM\OrderBy({"name" = "ASC"}) |
|
47 * |
|
48 * @var \Doctrine\Common\Collections\ArrayCollection |
|
49 */ |
|
50 private $categories; |
39 |
51 |
40 |
52 |
41 /** |
53 /** |
42 * Get id |
54 * Get id |
43 * |
55 * |
86 */ |
98 */ |
87 public function getDescription() |
99 public function getDescription() |
88 { |
100 { |
89 return $this->description; |
101 return $this->description; |
90 } |
102 } |
|
103 |
|
104 /** |
|
105 * Get categories list |
|
106 * |
|
107 * @return \Doctrine\Common\Collections\ArrayCollection |
|
108 */ |
|
109 public function getCategories() |
|
110 { |
|
111 return $this->categories; |
|
112 } |
|
113 |
|
114 /** |
|
115 * get the list of categories as string |
|
116 * |
|
117 */ |
|
118 public function getCategoriesStr() |
|
119 { |
|
120 $res = array(); |
|
121 foreach($this->getCategories() as $cat) { |
|
122 $res[] = $cat->getName(); |
|
123 } |
|
124 return implode(",", $res); |
|
125 } |
|
126 |
|
127 |
|
128 public function __construct() { |
|
129 $this->categories = new \Doctrine\Common\Collections\ArrayCollection(); |
|
130 } |
|
131 |
91 } |
132 } |