<?phpnamespace App\Daikin\BaseBundle\Entity\Survey;use App\Daikin\BaseBundle\Entity\Company;use App\Daikin\BaseBundle\Entity\LivingTrait;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\ORM\Mapping as ORM;/** * @ORM\Entity * @ORM\Table(name="survey_protocol_group") */class ProtocolGroup{ use LivingTrait; /** * @var string * @ORM\Column(type="string") */ private $name; /** * @var bool * @ORM\Column(type="boolean") */ private $open; /** * @var ArrayCollection|Protocol[] * @ORM\OneToMany(targetEntity="App\Daikin\BaseBundle\Entity\Survey\Protocol", mappedBy="group") */ private $protocols; /** * @var ArrayCollection|Company[] * @ORM\ManyToMany(targetEntity="App\Daikin\BaseBundle\Entity\Company", inversedBy="protocol_groups") * @ORM\JoinTable(name="survey_protocol_groups_to_companies", * joinColumns={ * @ORM\JoinColumn(name="protocolgroup_id", onDelete="CASCADE") * } * ) */ private $companies; public function __construct() { $this->open = false; $this->protocols = new ArrayCollection; $this->companies = new ArrayCollection; $this->traitConstruct(); } /** * @param string $name * @return $this */ public function setName($name) { $this->name = $name; return $this; } /** * @return string */ public function getName() { return $this->name; } /** * @param bool $open * @return $this */ public function setOpen($open) { $this->open = $open; return $this; } /** * @return bool */ public function isOpen() { return $this->open; } /** * @return Protocol[]|ArrayCollection */ public function getProtocols() { return $this->protocols; } /** * @return Company[]|ArrayCollection */ public function getCompanies() { return $this->companies; } /** * @return bool */ public function isDeletable() { return ($this->protocols->count() == 0); }}