/** * @View() */ public function getPlaceEventsAction(Place $place) { $factory = $this->get('krombox.event.wrapper_factory'); $events = []; foreach ($place->getEvents() as $event) { $events[] = $factory->wrap($event); } return $events; }
protected function deactivatePlaceMembership(Place $place) { foreach ($place->getMembershipSubscriptions() as $subscription) { if ($subscription->getStatus() == MembershipStatusType::ACTIVE) { $subscription->setStatus(MembershipStatusType::INACTIVE); $subscription->setEndsAt(new \DateTime("now")); } $this->em->persist($subscription); } $this->em->flush(); }
/** * @FW\Route("/place/{slug}/pay", name="place_pay") * @FW\Security("is_granted('ROLE_USER')") * @FW\Template */ public function placePayAction(Place $place) { $paymentArr = ['amt' => 15.25, 'ccy' => 'UAH', 'details' => $place->getName(), 'ext_details' => $place->getId(), 'pay_way' => 'privat24', 'order' => sha1($place->getHash() . time())]; //$payment = implode('&', $paymentArr); $payment = ''; foreach ($paymentArr as $key => $val) { $payment .= $key . '=' . $val . '&'; } $paymentArr['merchant'] = '103854'; $payment .= 'merchant=103854'; //var_dump($payment);die(); $pass = '******'; $signature = sha1(md5($payment . $pass)); $paymentArr['signature'] = $signature; //$em = $this->getDoctrine()->getManager(); //file_put_contents('privatapiresponse.txt', 'ddddd'); return compact('paymentArr'); }
/** * @FW\Route("/unrate/place/{hash}", name="place_unrate") * @FW\Method("post") * @FW\Security("is_granted('unrate', place)") */ public function unRatePlaceAction(Place $place, Request $request) { $em = $this->getDoctrine()->getManager(); $rating = $em->getRepository(Rating::class)->findOneBy(['place' => $place, 'user' => $this->getUser()]); $em->remove($rating); $em->flush(); return new JsonResponse(['rating' => $place->getRating()], 200); }