/** * Remove Pic from Event */ public function removePicFromEvent(Event $event) { $pic = $event->getPic(); $picPath = $pic->getPath(); $event->removePic(); $this->dm->persist($event); $this->dm->flush(); if ($this->forceDeleteOnDisk && $picPath) { $this->deleteFileOnDisk($picPath, $event); } return $event; }
public function testSetterAndGetter() { $live = new Live(); $name = 'event name'; $place = 'event place'; $date = new \DateTime(); $duration = '60'; $display = 0; $create_serial = 0; $locale = 'en'; $schedule = array('date' => $date, 'duration' => $duration); $pic = new Pic(); $imagePath = '/path/to/image.jpg'; $pic->setPath($imagePath); $event = new Event(); $event->setLive($live); $event->setName($name); $event->setPlace($place); $event->setDate($date); $event->setDuration($duration); $event->setDisplay($display); $event->setCreateSerial($create_serial); $event->setPic($pic); $event->setLocale($locale); $event->setSchedule($schedule); $this->assertEquals($live, $event->getLive()); $this->assertEquals($name, $event->getName()); $this->assertEquals($place, $event->getPlace()); $this->assertEquals($date, $event->getDate()); $this->assertEquals($duration, $event->getDuration()); $this->assertEquals($display, $event->getDisplay()); $this->assertEquals($create_serial, $event->getCreateSerial()); $this->assertEquals($locale, $event->getLocale()); $this->assertEquals($pic, $event->getPic()); $this->assertEquals($schedule, $event->getSchedule()); }