Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Item
- {
- /**
- * @ORM\ManyToMany(targetEntity="Category", inversedBy="items", cascade={"persist"})
- * @ORM\JoinTable(name="item_category",
- * joinColumns={@ORM\JoinColumn(name="item_id", referencedColumnName="id")},
- * inverseJoinColumns={@ORM\JoinColumn(name="category_id", referencedColumnName="id")}
- * )
- */
- private $categories;
- /**
- * Add categories
- *
- * @param Ako\StoreBundle\Entity\Category $categories
- */
- public function addCategories(\Ako\StoreBundle\Entity\Category $categories)
- {
- $this->categories[] = $categories;
- }
- /**
- * Get categories
- *
- * @return Doctrine\Common\Collections\Collection
- */
- public function getCategories()
- {
- return $this->categories;
- }
- }
- class Category implements ChoiceListInterface
- {
- /**
- * @ORM\ManyToMany(targetEntity="Item", mappedBy="categories", cascade={"persist"})
- */
- private $items;
- /**
- * Add items
- *
- * @param Ako\StoreBundle\Entity\Item $items
- */
- public function addItems(\Ako\StoreBundle\Entity\Item $items)
- {
- $this->items[] = $items;
- }
- /**
- * Get items
- *
- * @return Doctrine\Common\Collections\Collection
- */
- public function getItems()
- {
- return $this->items;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement