Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * ProductCategory
- */
- namespace XBSAppBundleEntity;
- use GedmoMappingAnnotation as Gedmo;
- use DoctrineORMMapping as ORM;
- use SymfonyComponentValidatorConstraints as Assert;
- /**
- * ProductCategory
- * @ORMEntity(repositoryClass="AppBundleRepositoryProductCategoryRepository")
- * @GedmoTree(type="nested")
- * ...
- */
- class ProductCategory
- {
- /**
- * @ORMId
- * @ORMColumn(name="id", type="integer")
- * @ORMGeneratedValue(strategy="AUTO")
- */
- protected $id;
- /**
- * @ORMManyToOne(targetEntity="AppBundleEntityProduct", inversedBy="productCategories")
- * @AssertNotNull()
- */
- protected $product;
- /**
- * @GedmoTreeParent
- * @ORMManyToOne(targetEntity="AppBundleEntityCategory", inversedBy="productCategories")
- * @AssertNotNull()
- */
- protected $category;
- /**
- * @GedmoTreeParent
- * @ORMManyToOne(targetEntity="AppBundleEntityCategory", inversedBy="children" )
- * @ORMJoinColumn(name="parent_id", referencedColumnName="id", onDelete="CASCADE")
- */
- protected $parent;
- /**
- * @ORMOneToMany(targetEntity="AppBundleEntityCategory", mappedBy="parent")
- * @ORMOrderBy({"lft" = "ASC"})
- */
- protected $children;
- /**
- * Get id
- *
- * @return integer
- */
- public function getId()
- {
- return $this->id;
- }
- /**
- * setProduct
- *
- * @param null $product
- * @return $this
- */
- public function setProduct($product = null)
- {
- $this->product = $product;
- return $this;
- }
- /**
- * getProduct
- * @return mixed
- */
- public function getProduct()
- {
- return $this->product;
- }
- /**
- * setCategory
- *
- * @param null $category
- * @return $this
- */
- public function setCategory($category = null)
- {
- $this->category = $category;
- return $this;
- }
- /**
- * getCategory
- * @return mixed
- */
- public function getCategory()
- {
- return $this->category;
- }
- /**
- * @return String empty
- */
- public function __toString(){
- return '';
- }
- }
Add Comment
Please, Sign In to add comment