Example #1
0
 /**
  * Uloží se vstupenka
  * @param \App\Model\Entity\Event $event
  * @param array $values
  */
 function saveTicket($event, $values = NULL)
 {
     $ticketInfo = new \App\Model\Entity\TicketInfo();
     $ticketInfo->setName($values['name']);
     $ticketInfo->setType($values['type']);
     $ticketInfo->setPrice(Money::CZK(intval($values['price'] * 100)));
     $ticketInfo->setFinalPrice(Money::CZK(intval($values['finalPrice'] * 100)));
     $ticketInfo->setAvailable($values['available']);
     $ticketInfo->setBought($values['bought']);
     $ticketInfo->setDateStart(new \DateTime($values['dateStart']));
     $ticketInfo->setDateEnd(new \DateTime($values['dateEnd']));
     $ticketInfo->setEvent($event);
     $this->em->persist($ticketInfo);
     $event->addTicketInfo($ticketInfo);
     return $this->saveEvent($event);
 }