3 namespace Doctrine\Tests\ORM\Functional\Ticket;
5 require_once __DIR__ . '/../../../TestInit.php';
7 class DDC1181Test extends \Doctrine\Tests\OrmFunctionalTestCase
9 public function setUp()
12 $this->_schemaTool->createSchema(array(
13 $this->_em->getClassMetadata(__NAMESPACE__ . '\\DDC1181Hotel'),
14 $this->_em->getClassMetadata(__NAMESPACE__ . '\\DDC1181Booking'),
15 $this->_em->getClassMetadata(__NAMESPACE__ . '\\DDC1181Room'),
22 public function testIssue()
24 $hotel = new DDC1181Hotel();
25 $room1 = new DDC1181Room();
26 $room2 = new DDC1181Room();
28 $this->_em->persist($hotel);
29 $this->_em->persist($room1);
30 $this->_em->persist($room2);
33 $booking1 = new DDC1181Booking;
34 $booking1->hotel = $hotel;
35 $booking1->room = $room1;
36 $booking2 = new DDC1181Booking;
37 $booking2->hotel = $hotel;
38 $booking2->room = $room2;
39 $hotel->bookings[] = $booking1;
40 $hotel->bookings[] = $booking2;
42 $this->_em->persist($booking1);
43 $this->_em->persist($booking2);
46 $this->_em->remove($hotel);
56 /** @Id @Column(type="integer") @GeneratedValue */
60 * @oneToMany(targetEntity="DDC1181Booking", mappedBy="hotel", cascade={"remove"})
76 * @ManyToOne(targetEntity="DDC1181Hotel", inversedBy="bookings")
78 * @JoinColumn(name="hotel_id", referencedColumnName="id")
86 * @ManyToOne(targetEntity="DDC1181Room")
88 * @JoinColumn(name="room_id", referencedColumnName="id")
99 /** @Id @Column(type="integer") @GeneratedValue */