Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * @Entity
- * @InheritanceType("JOINED")
- * @DiscriminatorColumn(name="event_type", type="string")
- * @DiscriminatorMap({"auction" = "Auction", "raffle" = "Raffle"})
- */
- class Event {
- /**
- * @Id @Column(type="integer")
- * @GeneratedValue(strategy="AUTO")
- */
- private $id;
- /**
- * @OneToOne(targetEntity="Organization",cascade={"persist"})
- * @JoinColumn(name="org_id", referencedColumnName="id")
- */
- private $organization;
- }
- class Organization {
- /**
- * @Id @Column(type="integer")
- * @GeneratedValue(strategy="AUTO")
- */
- private $id;
- /**
- * @OneToMany(targetEntity="Event", mappedBy="organization")
- */
- private $events;
- public function getId() {
- return $this->id;
- }
- }
- $q = $em->createQuery('select a from Organization a where a.id = 3');
- $a = $q->getResult();
- $events = $a[0]->getEvents();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement