Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace BaseBundle\Entity;
- use Doctrine\ORM\Mapping as ORM;
- use Gedmo\Mapping\Annotation as Gedmo;
- use Symfony\Component\Validator\Constraints as Assert;
- /**
- * BaseCategory
- *
- * @ORM\Entity()
- * @ORM\InheritanceType("JOINED")
- * @ORM\DiscriminatorColumn(name="type", type="string")
- * @ORM\DiscriminatorMap({
- * "article_category" = "AppBundle\Entity\ArticleCategory",
- * "page_category" = "AppBundle\Entity\PageCategory",
- * })
- * @Gedmo\Tree(type="nested")
- */
- abstract class BaseCategory
- {
- use \BaseBundle\Traits\SeoTrait;
- /**
- * @var int
- *
- * @ORM\Column(name="id", type="integer")
- * @ORM\Id
- * @ORM\GeneratedValue(strategy="AUTO")
- */
- private $id;
- /**
- * @var string
- *
- * @ORM\Column(name="title", type="string", length=255)
- * @Assert\NotBlank()
- */
- private $title;
- /**
- * @var string
- *
- * @ORM\Column(name="slug", type="string", length=255, unique=true)
- * @Gedmo\Slug(fields={"title"})
- */
- private $slug;
- /**
- * @var string
- *
- * @ORM\Column(name="description", type="text")
- */
- private $description;
- /**
- * @var \DateTime
- *
- * @ORM\Column(type="datetime")
- * @Gedmo\Timestampable(on="create")
- */
- private $createdAt;
- /**
- * @var \DateTime
- *
- * @ORM\Column(type="datetime")
- * @Gedmo\Timestampable(on="update")
- */
- private $updatedAt;
- /**
- * @Gedmo\TreeLeft
- * @ORM\Column(type="integer")
- */
- private $lft;
- /**
- * @Gedmo\TreeLevel
- * @ORM\Column(type="integer")
- */
- private $lvl;
- /**
- * @Gedmo\TreeRight
- * @ORM\Column(type="integer")
- */
- private $rgt;
- /**
- * @Gedmo\TreeRoot
- * @ORM\ManyToOne(targetEntity="BaseCategory")
- * @ORM\JoinColumn(referencedColumnName="id", onDelete="CASCADE")
- */
- private $root;
- /**
- * @Gedmo\TreeParent
- * @ORM\ManyToOne(targetEntity="BaseCategory", inversedBy="children")
- * @ORM\JoinColumn(referencedColumnName="id", onDelete="CASCADE")
- */
- private $parent;
- /**
- * @ORM\OneToMany(targetEntity="BaseCategory", mappedBy="parent")
- * @ORM\OrderBy({"lft" = "ASC"})
- */
- private $children;
- /**
- * Get id
- *
- * @return int
- */
- public function getId()
- {
- return $this->id;
- }
- /**
- * Set title
- *
- * @param string $title
- *
- * @return BaseCategory
- */
- public function setTitle($title)
- {
- $this->title = $title;
- return $this;
- }
- /**
- * Get title
- *
- * @return string
- */
- public function getTitle()
- {
- return $this->title;
- }
- /**
- * Set slug
- *
- * @param string $slug
- *
- * @return BaseCategory
- */
- public function setSlug($slug)
- {
- $this->slug = $slug;
- return $this;
- }
- /**
- * Get slug
- *
- * @return string
- */
- public function getSlug()
- {
- return $this->slug;
- }
- /**
- * Set description
- *
- * @param string $description
- *
- * @return BaseCategory
- */
- public function setDescription($description)
- {
- $this->description = $description;
- return $this;
- }
- /**
- * Get description
- *
- * @return string
- */
- public function getDescription()
- {
- return $this->description;
- }
- /**
- * @return \DateTime
- */
- public function getCreatedAt()
- {
- return $this->createdAt;
- }
- /**
- * @return \DateTime
- */
- public function getUpdatedAt()
- {
- return $this->updatedAt;
- }
- public function getRoot()
- {
- return $this->root;
- }
- public function setParent(BaseCategory $parent = null)
- {
- $this->parent = $parent;
- }
- public function getParent()
- {
- return $this->parent;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement