CompanyOrganization.php 1012B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. namespace Doctrine\Tests\Models\Company;
  3. /** @Entity @Table(name="company_organizations") */
  4. class CompanyOrganization {
  5. /**
  6. * @Id @Column(type="integer")
  7. * @GeneratedValue(strategy="AUTO")
  8. */
  9. private $id;
  10. /**
  11. * @OneToMany(targetEntity="CompanyEvent", mappedBy="organization", cascade={"persist"})
  12. */
  13. private $events;
  14. public function getId() {
  15. return $this->id;
  16. }
  17. public function getEvents() {
  18. return $this->events;
  19. }
  20. public function addEvent(CompanyEvent $event) {
  21. $this->events[] = $event;
  22. $event->setOrganization($this);
  23. }
  24. /**
  25. * @OneToOne(targetEntity="CompanyEvent", cascade={"persist"})
  26. * @JoinColumn(name="main_event_id", referencedColumnName="id", nullable=true)
  27. */
  28. private $mainevent;
  29. public function getMainEvent() {
  30. return $this->mainevent;
  31. }
  32. public function setMainEvent($event) {
  33. $this->mainevent = $event;
  34. }
  35. }