src/Daikin/BaseBundle/Entity/Survey/ProtocolGroup.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Daikin\BaseBundle\Entity\Survey;
  3. use App\Daikin\BaseBundle\Entity\Company;
  4. use App\Daikin\BaseBundle\Entity\LivingTrait;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity
  9.  * @ORM\Table(name="survey_protocol_group")
  10.  */
  11. class ProtocolGroup
  12. {
  13.     use LivingTrait;
  14.     /**
  15.      * @var string
  16.      * @ORM\Column(type="string")
  17.      */
  18.     private $name;
  19.     /**
  20.      * @var bool
  21.      * @ORM\Column(type="boolean")
  22.      */
  23.     private $open;
  24.     /**
  25.      * @var ArrayCollection|Protocol[]
  26.      * @ORM\OneToMany(targetEntity="App\Daikin\BaseBundle\Entity\Survey\Protocol", mappedBy="group")
  27.      */
  28.     private $protocols;
  29.     /**
  30.      * @var ArrayCollection|Company[]
  31.      * @ORM\ManyToMany(targetEntity="App\Daikin\BaseBundle\Entity\Company", inversedBy="protocol_groups")
  32.      * @ORM\JoinTable(name="survey_protocol_groups_to_companies",
  33.      *     joinColumns={
  34.      *          @ORM\JoinColumn(name="protocolgroup_id", onDelete="CASCADE")
  35.      *     }
  36.      * )
  37.      */
  38.     private $companies;
  39.     public function __construct()
  40.     {
  41.         $this->open false;
  42.         $this->protocols = new ArrayCollection;
  43.         $this->companies = new ArrayCollection;
  44.         $this->traitConstruct();
  45.     }
  46.     /**
  47.      * @param string $name
  48.      * @return $this
  49.      */
  50.     public function setName($name)
  51.     {
  52.         $this->name $name;
  53.         return $this;
  54.     }
  55.     /**
  56.      * @return string
  57.      */
  58.     public function getName()
  59.     {
  60.         return $this->name;
  61.     }
  62.     /**
  63.      * @param bool $open
  64.      * @return $this
  65.      */
  66.     public function setOpen($open)
  67.     {
  68.         $this->open $open;
  69.         return $this;
  70.     }
  71.     /**
  72.      * @return bool
  73.      */
  74.     public function isOpen()
  75.     {
  76.         return $this->open;
  77.     }
  78.     /**
  79.      * @return Protocol[]|ArrayCollection
  80.      */
  81.     public function getProtocols()
  82.     {
  83.         return $this->protocols;
  84.     }
  85.     /**
  86.      * @return Company[]|ArrayCollection
  87.      */
  88.     public function getCompanies()
  89.     {
  90.         return $this->companies;
  91.     }
  92.     /**
  93.      * @return bool
  94.      */
  95.     public function isDeletable()
  96.     {
  97.         return ($this->protocols->count() == 0);
  98.     }
  99. }