123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261 |
- <?php
- namespace Entity;
- use Doctrine\ORM\Mapping as ORM;
- use Gedmo\Mapping\Annotation as Gedmo;
- use Doctrine\Common\Collections\ArrayCollection;
- /**
- * CQuizCategory
- *
- * @Gedmo\Tree(type="nested")
- * @ORM\Table(name="c_quiz_category")
- * @ORM\Entity(repositoryClass="Gedmo\Tree\Entity\Repository\NestedTreeRepository")
- */
- class CQuizCategory
- {
- /**
- * @var integer
- *
- * @ORM\Column(name="iid", type="integer", precision=0, scale=0, nullable=false, unique=false)
- * @ORM\Id
- * @ORM\GeneratedValue(strategy="IDENTITY")
- */
- private $iid;
- /**
- * @var integer
- *
- * @ORM\Column(name="c_id", type="integer", precision=0, scale=0, nullable=false, unique=false)
- */
- private $cId;
- /**
- * @var string
- *
- * @ORM\Column(name="title", type="string", length=255, precision=0, scale=0, nullable=false, unique=false)
- */
- private $title;
- /**
- * @var string
- *
- * @ORM\Column(name="description", type="text", precision=0, scale=0, nullable=false, unique=false)
- */
- private $description;
- /**
- *
- * @ORM\Column(name="parent_id", type="integer")
- */
- private $parentId;
- /**
- * @Gedmo\TreeParent
- * @ORM\ManyToOne(targetEntity="CQuizCategory", inversedBy="children")
- * @ORM\JoinColumn(name="parent_id", referencedColumnName="iid", onDelete="SET NULL")
- */
- private $parent;
- /**
- * @Gedmo\TreeLeft
- * @ORM\Column(name="lft", type="integer")
- */
- private $lft;
- /**
- * @Gedmo\TreeLevel
- * @ORM\Column(name="lvl", type="integer")
- */
- private $lvl;
- /**
- * @Gedmo\TreeRight
- * @ORM\Column(name="rgt", type="integer")
- */
- private $rgt;
- /**
- * @Gedmo\TreeRoot
- * @ORM\Column(name="root", type="integer", nullable=true)
- */
- private $root;
- /**
- * @ORM\OneToMany(targetEntity="CQuizCategory", mappedBy="parent")
- * @ORM\OrderBy({"lft" = "ASC"})
- */
- private $children;
- /**
- *
- * @ORM\Column(name="visibility", type="integer")
- */
- private $visibility;
- /**
- * @ORM\OneToMany(targetEntity="CQuizQuestionRelCategory", mappedBy="category")
- **/
- private $quizQuestionRelCategoryList;
- public function __construct()
- {
- $this->quizQuestionRelCategoryList = new ArrayCollection();
- }
- public function setParent(CQuizCategory $parent = null)
- {
- $this->parent = $parent;
- }
- public function getParent()
- {
- return $this->parent;
- }
- public function getQuestions()
- {
- $questions = new ArrayCollection();
- foreach ($this->quizQuestionRelCategoryList as $relQuestion) {
- $questions[] = $relQuestion->getQuestion();
- }
- return $questions;
- }
- /**
- * Set cId
- *
- * @param integer $cId
- * @return CQuizQuestionCategory
- */
- public function setCId($cId)
- {
- $this->cId = $cId;
- return $this;
- }
- /**
- * Get cId
- *
- * @return integer
- */
- public function getCId()
- {
- return $this->cId;
- }
- /**
- * Set id
- *
- * @param integer $id
- * @return CQuizQuestionCategory
- */
- public function setIid($id)
- {
- $this->iid = $id;
- return $this;
- }
- /**
- * Get id
- *
- * @return integer
- */
- public function getIid()
- {
- return $this->iid;
- }
- /**
- * Set title
- *
- * @param string $title
- * @return CQuizQuestionCategory
- */
- public function setTitle($title)
- {
- $this->title = $title;
- return $this;
- }
- /**
- * Get title
- *
- * @return string
- */
- public function getTitle()
- {
- return $this->title;
- }
- /**
- * Set description
- *
- * @param string $description
- * @return CQuizQuestionCategory
- */
- public function setDescription($description)
- {
- $this->description = $description;
- return $this;
- }
- /**
- * Get description
- *
- * @return string
- */
- public function getDescription()
- {
- return $this->description;
- }
- /**
- * Set cId
- *
- * @param integer $cId
- * @return CQuizQuestionCategory
- */
- public function setParentId($id)
- {
- $this->parentId = $id;
- return $this;
- }
- /**
- * Get cId
- *
- * @return integer
- */
- public function getParentId()
- {
- return $this->parentId;
- }
- /**
- * @return integer
- */
- public function getVisibility()
- {
- return $this->visibility;
- }
- /**
- * @param $visibility
- * @return $this
- */
- public function setVisibility($visibility)
- {
- $this->visibility = $visibility;
- return $this;
- }
- }
|