/** * @Route("/{id}") * @Method("PUT") */ public function putAction(UserFollow $follow, Request $request) { if ($this->getUser() !== $follow->getUser()) { throw new AccessDeniedHttpException(); } $data = json_decode($request->getContent(), true); if (!empty($data) && isset($data['status'])) { $follow->setStatus($data['status']); if ($follow->getStatus() === $follow::STATUS_ACTIVE) { $follow->setDateApproval(new \DateTime()); } } $this->getDoctrine()->getManager()->flush($follow); return $this->createJSONResponse($this->jmsSerialization($follow, ['api-follow', 'api-info']), 200); }
public function setDateApproval(\DateTime $date) { $this->__load(); return parent::setDateApproval($date); }