| Total Complexity | 10 |
| Total Lines | 118 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 15 | class EventGroup |
||
| 16 | { |
||
| 17 | /** |
||
| 18 | * @var int |
||
| 19 | * |
||
| 20 | * @ORM\Column(name="id", type="integer") |
||
| 21 | * @ORM\Id |
||
| 22 | * @ORM\GeneratedValue(strategy="AUTO") |
||
| 23 | */ |
||
| 24 | private $id; |
||
| 25 | |||
| 26 | /** |
||
| 27 | * @var string |
||
| 28 | * |
||
| 29 | * @ORM\Column(type="string", nullable=false) |
||
| 30 | * |
||
| 31 | * @Assert\NotNull() |
||
| 32 | * @Assert\NotBlank() |
||
| 33 | */ |
||
| 34 | private $name; |
||
| 35 | |||
| 36 | /** |
||
| 37 | * @ORM\OneToMany(targetEntity="Stfalcon\Bundle\EventBundle\Entity\Event", mappedBy="group", cascade={"remove", "persist"}) |
||
| 38 | */ |
||
| 39 | private $events; |
||
| 40 | |||
| 41 | /** |
||
| 42 | * EventGroup constructor. |
||
| 43 | */ |
||
| 44 | public function __construct() |
||
| 45 | { |
||
| 46 | $this->events = new ArrayCollection(); |
||
| 47 | } |
||
| 48 | |||
| 49 | /** |
||
| 50 | * @return mixed |
||
| 51 | */ |
||
| 52 | public function getId() |
||
| 53 | { |
||
| 54 | return $this->id; |
||
| 55 | } |
||
| 56 | |||
| 57 | /** |
||
| 58 | * @return string |
||
| 59 | */ |
||
| 60 | public function getName() |
||
| 61 | { |
||
| 62 | return $this->name; |
||
| 63 | } |
||
| 64 | |||
| 65 | /** |
||
| 66 | * @param string $name |
||
| 67 | * |
||
| 68 | * @return $this |
||
| 69 | */ |
||
| 70 | public function setName($name) |
||
| 71 | { |
||
| 72 | $this->name = $name; |
||
| 73 | |||
| 74 | return $this; |
||
| 75 | } |
||
| 76 | |||
| 77 | /** |
||
| 78 | * @return ArrayCollection $events |
||
| 79 | */ |
||
| 80 | public function getEvents() |
||
| 81 | { |
||
| 82 | return $this->events; |
||
| 83 | } |
||
| 84 | |||
| 85 | /** |
||
| 86 | * @param ArrayCollection $events |
||
| 87 | * |
||
| 88 | * @return $this |
||
| 89 | */ |
||
| 90 | public function setEvents($events) |
||
| 91 | { |
||
| 92 | $this->events = $events; |
||
| 93 | |||
| 94 | return $this; |
||
| 95 | } |
||
| 96 | |||
| 97 | /** |
||
| 98 | * @param Event $event |
||
| 99 | * |
||
| 100 | * @return $this |
||
| 101 | */ |
||
| 102 | public function addEvent($event) |
||
| 103 | { |
||
| 104 | $event->setGroup($this); |
||
| 105 | $this->events[] = $event; |
||
| 106 | |||
| 107 | return $this; |
||
| 108 | } |
||
| 109 | |||
| 110 | /** |
||
| 111 | * @param Event $event |
||
| 112 | * |
||
| 113 | * @return $this |
||
| 114 | */ |
||
| 115 | public function removeEvent($event) |
||
| 116 | { |
||
| 117 | $event->setGroup(null); |
||
| 118 | $this->events->removeElement($event); |
||
| 119 | |||
| 120 | return $this; |
||
| 121 | } |
||
| 122 | |||
| 123 | /** |
||
| 124 | * @return string |
||
| 125 | */ |
||
| 126 | public function __toString() |
||
| 133 | } |
||
| 134 | } |
||
| 135 |