src/Submarine/PropertiesBundle/Entity/Group.php line 18

Open in your IDE?
  1. <?php
  2. /**
  3.  * (c) itmedia.by <info@itmedia.by>
  4.  */
  5. namespace Submarine\PropertiesBundle\Entity;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. use Submarine\CoreBundle\Entity\SubmarineEntityInterface;
  8. use Doctrine\ORM\Mapping as ORM;
  9. use Symfony\Component\Validator\Constraints as Asset;
  10. /**
  11.  * @ORM\Entity()
  12.  * @ORM\Table(name="submarine_properties_group")
  13.  */
  14. class Group implements SubmarineEntityInterface
  15. {
  16.     /**
  17.      * @var int
  18.      *
  19.      * @ORM\Id()
  20.      * @ORM\Column(name="id", type="integer", nullable=false, unique=true)
  21.      * @ORM\GeneratedValue(strategy="AUTO")
  22.      */
  23.     private $id;
  24.     /**
  25.      * @var string
  26.      *
  27.      * @ORM\Column(name="title", type="string", nullable=false)
  28.      * @Asset\NotBlank()
  29.      */
  30.     private $title;
  31.     /**
  32.      * @var Property[]|ArrayCollection
  33.      *
  34.      * @ORM\OneToMany(targetEntity="Submarine\PropertiesBundle\Entity\Property", mappedBy="group", indexBy="id")
  35.      * @ORM\OrderBy({"position" = "ASC", "title" = "ASC"})
  36.      */
  37.     private $properties;
  38.     /**
  39.      * @var int
  40.      *
  41.      * @ORM\Column(name="position", type="integer", nullable=true)
  42.      */
  43.     private $position 10;
  44.     public function __construct()
  45.     {
  46.         $this->properties = new ArrayCollection();
  47.     }
  48.     /**
  49.      * Имя сущности
  50.      * @return string
  51.      */
  52.     public static function entityName()
  53.     {
  54.         return __CLASS__;
  55.     }
  56.     /**
  57.      * @return int
  58.      */
  59.     public function getId()
  60.     {
  61.         return $this->id;
  62.     }
  63.     /**
  64.      * @return string
  65.      */
  66.     public function getTitle()
  67.     {
  68.         return $this->title;
  69.     }
  70.     /**
  71.      * @param string $title
  72.      */
  73.     public function setTitle($title)
  74.     {
  75.         $this->title $title;
  76.     }
  77.     /**
  78.      * @return ArrayCollection|Property[]
  79.      */
  80.     public function getProperties()
  81.     {
  82.         return $this->properties;
  83.     }
  84.     /**
  85.      * @return int
  86.      */
  87.     public function getPosition()
  88.     {
  89.         return $this->position;
  90.     }
  91.     /**
  92.      * @param int $position
  93.      */
  94.     public function setPosition($position)
  95.     {
  96.         $this->position $position;
  97.     }
  98. }