src/Entity/EventOpsProd.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. /**
  7.  * Document
  8.  *
  9.  * @ORM\Table(name="event_opsprod")
  10.  * @ORM\Entity
  11.  */
  12. class EventOpsProd
  13. {
  14.     use \Gedmo\Timestampable\Traits\TimestampableEntity;
  15.     use BlameableEntity;
  16.     /**
  17.      * @var int
  18.      *
  19.      * @ORM\Column(name="id", type="integer")
  20.      * @ORM\Id
  21.      * @ORM\GeneratedValue(strategy="AUTO")
  22.      */
  23.     private $id;
  24.     /**
  25.      * EDITABLE IN ENET
  26.      * @ORM\OneToMany(targetEntity="App\Entity\EventUserRights", mappedBy="eventOpsProd", cascade={"all"}, orphanRemoval=true)
  27.      */
  28.     private $userRights;
  29.     /**
  30.      * EDITABLE IN ENET
  31.      * @ORM\OneToMany(targetEntity="App\Entity\EventCompanyRights", mappedBy="eventOpsProd", cascade={"all"}, orphanRemoval=true)
  32.      */
  33.     private $companyRights;
  34.     /**
  35.      * @var Event $event
  36.      * @ORM\OneToOne(targetEntity="App\Entity\Event", mappedBy="eventOpsProd")
  37.      * @ORM\JoinColumn(name="event_id", referencedColumnName="id")
  38.      */
  39.     private $event;
  40.     public function __construct()
  41.     {
  42.         $this->userRights = new ArrayCollection();
  43.         $this->companyRights = new ArrayCollection();
  44.     }
  45.     public function __toString(): string
  46.     {
  47.         return 'Opsprod for ' $this->event->getEventNo();
  48.     }
  49.     /**
  50.      * @return Event
  51.      */
  52.     public function getEvent(): Event
  53.     {
  54.         return $this->event;
  55.     }
  56.     /**
  57.      * @param Event $event
  58.      */
  59.     public function setEvent(Event $event): void
  60.     {
  61.         $this->event $event;
  62.     }
  63.     public function addUserRightsUid(string $uid)
  64.     {
  65.         $eventUserRights = new EventUserRights();
  66.         $eventUserRights->setEventOpsProd($this);
  67.         $eventUserRights->setUid($uid);
  68.         $this->userRights->add($eventUserRights);
  69.     }
  70.     /**
  71.      * WARN used by introspection by sonata admin
  72.      *
  73.      * @param EventUserRights $eventUserRights
  74.      */
  75.     public function addUserRight(EventUserRights $eventUserRights)
  76.     {
  77.         $eventUserRights->setEventOpsProd($this);
  78.         $this->userRights->add($eventUserRights);
  79.     }
  80.     /**
  81.      * Remove userRight
  82.      *
  83.      * @param EventUserRights $userRight
  84.      */
  85.     public function removeUserRight(EventUserRights $userRight)
  86.     {
  87.         $this->userRights->removeElement($userRight);
  88.     }
  89.     public function addCompanyRightsUid(string $uid)
  90.     {
  91.         $eventCompanyRights = new EventCompanyRights();
  92.         $eventCompanyRights->setEventOpsProd($this);
  93.         $eventCompanyRights->setUid($uid);
  94.         $this->companyRights->add($eventCompanyRights);
  95.     }
  96.     /**
  97.      * WARN used by introspection by sonata admin
  98.      *
  99.      * @param EventCompanyRights $eventCompanyRights
  100.      */
  101.     public function addCompanyRight(EventCompanyRights $eventCompanyRights)
  102.     {
  103.         $eventCompanyRights->setEventOpsProd($this);
  104.         $this->companyRights->add($eventCompanyRights);
  105.     }
  106.     /**
  107.      * @param EventCompanyRights $companyRights
  108.      */
  109.     public function removeCompanyRight(EventCompanyRights $companyRights)
  110.     {
  111.         $this->companyRights->removeElement($companyRights);
  112.     }
  113.     /**
  114.      * @return mixed
  115.      */
  116.     public function getUserRights(): Collection
  117.     {
  118.         return $this->userRights;
  119.     }
  120.     /**
  121.      * @param mixed $userRights
  122.      */
  123.     public function setUserRights(Collection $userRights): void
  124.     {
  125.         $this->userRights $userRights;
  126.     }
  127.     /**
  128.      * @return mixed
  129.      */
  130.     public function getCompanyRights(): Collection
  131.     {
  132.         return $this->companyRights;
  133.     }
  134.     /**
  135.      * @param mixed $companyRights
  136.      */
  137.     public function setCompanyRights(Collection $companyRights): void
  138.     {
  139.         $this->companyRights $companyRights;
  140.     }
  141.     /**
  142.      * Get id
  143.      *
  144.      * @return integer
  145.      */
  146.     public function getId()
  147.     {
  148.         return $this->id;
  149.     }
  150.     public function toString(): string
  151.     {
  152.         return "{id=" $this->id "}";
  153.     }
  154. }