Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace Jpg\Events\Domain\Model;
- /* *
- * This script belongs to the TYPO3 Flow package "Jpg.Events". *
- * *
- * */
- use TYPO3\Flow\Annotations as Flow;
- use Doctrine\ORM\Mapping as ORM;
- /**
- * A Event
- *
- * @Flow\Entity
- */
- class Event {
- /**
- * The title
- * @var string
- * @Flow\Validate(type="NotEmpty")
- * @Flow\Validate(type="String")
- * @Flow\Validate(type="StringLength", options={ "minimum"=5, "maximum"=100 })
- */
- protected $title;
- /**
- * @var \Jpg\Events\Domain\Model\Location
- * @ORM\ManyToOne
- */
- protected $location;
- /**
- * @var \Doctrine\Common\Collections\Collection<\Jpg\Events\Domain\Model\Person>
- * @ORM\ManyToMany(inversedBy="events")
- */
- protected $persons;
- /**
- * Constructs this event
- */
- public function __construct() {
- //Only for properties which have a @var \Doctrine\Common\Collections\Collection<...> or non Standard Annotation ???
- //$this->persons = new \Doctrine\Common\Collections\ArrayCollection();
- $this->persons = new \Doctrine\Common\Collections\ArrayCollection();
- }
- /**
- * Get the Event's title
- *
- * @return string The Event's title
- */
- public function getTitle() {
- return $this->title;
- }
- /**
- * Sets this Event's title
- *
- * @param string $title The Event's title
- * @return void
- */
- public function setTitle($title) {
- $this->title = $title;
- }
- /**
- * setter for location
- *
- * @param \Jpg\Events\Domain\Model\Location $location
- * @return void
- */
- public function setLocation($location) {
- $this->location = $location;
- }
- /**
- * getter for location
- *
- * @return \Jpg\Events\Domain\Model\Location
- */
- public function getLocation() {
- return $this->location;
- }
- /**
- * Setter for person
- *
- * @param \Doctrine\Common\Collections\Collection<\Jpg\Events\Domain\Model\Person> $persons The attending persons
- * @return void
- */
- public function setPersons(\Doctrine\Common\Collections\Collection $persons) {
- $this->persons = clone $persons;
- }
- /**
- * Adds a person to this event
- *
- * @param \Jpg\Events\Domain\Model\Person $person
- * @return void
- */
- public function addPerson(\Jpg\Events\Domain\Model\Person $person) {
- $this->persons->add($person);
- }
- /**
- * Removes a person to this event
- *
- * @param \Jpg\Events\Domain\Model\Person $person
- * @return void
- */
- public function removePerson(\Jpg\Events\Domain\Model\Person $person) {
- $this->persons->remove($person);
- }
- /**
- * Getter for persons
- *
- * @return \Doctrine\Common\Collections\Collection<\Jpg\Events\Domain\Model\Person> The attending persons
- */
- public function getPersons() {
- return clone $this->persons;
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment