private function convertAnnouncement(Announcement $announcement, $full) { $serialized = array('id' => $announcement->getId(), 'userName' => $announcement->getAdvertiser()->getUsername(), 'uid' => $announcement->getAdvertiser()->getId(), 'title' => $announcement->getTitle(), 'hasImage' => false, 'imageUrl' => '', 'addDate' => $announcement->getAddDate()->getTimestamp(), 'type' => $announcement->getAnnouncementPaymentType(), 'content' => $announcement->getDescription(), 'navigation' => array()); if ($full) { $serialized['navigation']['list'] = $this->router->generate('api_announcement_list', array(), true); } else { unset($serialized['content']); $serialized['navigation']['full'] = $this->router->generate('api_announcement', array('announcement' => $announcement->getId()), true); } return $serialized; }
/** * @expectedException \InvalidArgumentException * @expectedExceptionMessage Given announcement payment type is invalid * @covers \Hyper\AdsBundle\Entity\Announcement::setAnnouncementPaymentType */ public function testSetInvalidAnnouncementPaymentTypesProvider() { $this->ad->setAnnouncementPaymentType('invalid'); }
private function paymentScreen(Announcement $announcement) { $request = new MtgoxTransactionUrlRequest(); $request->setCurrency($this->container->getParameter('announcement_edit_currency')); $request->setIpnUrl($this->generateUrl('wikp_payment_mtgox_ipn')); $request->setAmount($this->container->getParameter('announcement_edit_cost')); $request->setAdditionalData($announcement->getId()); }