src/Submarine/PropertiesBundle/Entity/Property.php line 17

Open in your IDE?
  1. <?php
  2. /**
  3.  * (c) itmedia.by <info@itmedia.by>
  4.  */
  5. namespace Submarine\PropertiesBundle\Entity;
  6. use Submarine\CoreBundle\Entity\SubmarineEntityInterface;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Symfony\Component\Validator\Constraints as Asset;
  9. /**
  10.  * @ORM\Entity()
  11.  * @ORM\Table(name="submarine_properties")
  12.  */
  13. class Property implements SubmarineEntityInterface
  14. {
  15.     const TYPE_TEXT 'text';
  16.     const TYPE_CHOICE 'choice';
  17.     const TYPE_NUMBER 'number';
  18.     const TYPE_TEXTAREA 'textarea';
  19.     /**
  20.      * @var int
  21.      *
  22.      * @ORM\Id()
  23.      * @ORM\Column(name="id", type="integer", nullable=false, unique=true)
  24.      * @ORM\GeneratedValue(strategy="AUTO")
  25.      */
  26.     private $id;
  27.     /**
  28.      * @var Group
  29.      * @ORM\ManyToOne(targetEntity="Submarine\PropertiesBundle\Entity\Group", inversedBy="properties")
  30.      * @ORM\JoinColumn(name="group_id", referencedColumnName="id")
  31.      */
  32.     private $group;
  33.     /**
  34.      * @var string
  35.      *
  36.      * @ORM\Column(name="title", type="string", nullable=false)
  37.      * @Asset\NotBlank()
  38.      */
  39.     private $title;
  40.     /**
  41.      * @var string
  42.      *
  43.      * @ORM\Column(name="description", type="text", nullable=true)
  44.      */
  45.     private $description;
  46.     /**
  47.      * @var string
  48.      *
  49.      * @ORM\Column(name="value_type", type="string", nullable=false)
  50.      */
  51.     private $valueType self::TYPE_TEXT;
  52.     /**
  53.      * @var string
  54.      *
  55.      * @ORM\Column(name="value_postfix", type="string", nullable=true)
  56.      */
  57.     private $valuePostfix '';
  58.     /**
  59.      * @var array
  60.      *
  61.      * @ORM\Column(name="values_choice", type="array", nullable=true)
  62.      */
  63.     private $valuesChoice = [];
  64.     /**
  65.      * @var string
  66.      *
  67.      * @ORM\Column(name="value_default", type="string", nullable=true)
  68.      */
  69.     private $valueDefault;
  70.     /**
  71.      * @var int
  72.      *
  73.      * @ORM\Column(name="position", type="integer", nullable=true)
  74.      */
  75.     private $position 0;
  76.     /**
  77.      * @return int
  78.      */
  79.     public function getId()
  80.     {
  81.         return $this->id;
  82.     }
  83.     /**
  84.      * Имя сущности
  85.      * @return string
  86.      */
  87.     public static function entityName()
  88.     {
  89.         return __CLASS__;
  90.     }
  91.     /**
  92.      * @return string
  93.      */
  94.     public function getTitle()
  95.     {
  96.         return $this->title;
  97.     }
  98.     /**
  99.      * @param string $title
  100.      */
  101.     public function setTitle($title)
  102.     {
  103.         $this->title $title;
  104.     }
  105.     /**
  106.      * @return string
  107.      */
  108.     public function getDescription()
  109.     {
  110.         return $this->description;
  111.     }
  112.     /**
  113.      * @param string $description
  114.      */
  115.     public function setDescription($description)
  116.     {
  117.         $this->description $description;
  118.     }
  119.     /**
  120.      * @return Group
  121.      */
  122.     public function getGroup()
  123.     {
  124.         return $this->group;
  125.     }
  126.     /**
  127.      * @param Group $group
  128.      */
  129.     public function setGroup(Group $group)
  130.     {
  131.         $this->group $group;
  132.     }
  133.     /**
  134.      * @return string
  135.      */
  136.     public function getValueType()
  137.     {
  138.         return $this->valueType;
  139.     }
  140.     /**
  141.      * @param string $valueType
  142.      */
  143.     public function setValueType($valueType)
  144.     {
  145.         $this->valueType $valueType;
  146.     }
  147.     /**
  148.      * @return string
  149.      */
  150.     public function getValuePostfix()
  151.     {
  152.         return $this->valuePostfix;
  153.     }
  154.     /**
  155.      * @param string $valuePostfix
  156.      */
  157.     public function setValuePostfix($valuePostfix)
  158.     {
  159.         $this->valuePostfix $valuePostfix;
  160.     }
  161.     /**
  162.      * @return array
  163.      */
  164.     public function getValuesChoice()
  165.     {
  166.         return $this->valuesChoice;
  167.     }
  168.     /**
  169.      * @param array $valuesChoice
  170.      */
  171.     public function setValuesChoice($valuesChoice)
  172.     {
  173.         $this->valuesChoice $valuesChoice;
  174.     }
  175.     /**
  176.      * @return string
  177.      */
  178.     public function getValueDefault()
  179.     {
  180.         return $this->valueDefault;
  181.     }
  182.     /**
  183.      * @param string $valueDefault
  184.      */
  185.     public function setValueDefault($valueDefault)
  186.     {
  187.         $this->valueDefault $valueDefault;
  188.     }
  189.     /**
  190.      * @return int
  191.      */
  192.     public function getPosition()
  193.     {
  194.         return $this->position;
  195.     }
  196.     /**
  197.      * @param int $position
  198.      */
  199.     public function setPosition($position)
  200.     {
  201.         $this->position $position;
  202.     }
  203. }