private function getLogin($contentEncoded, $user, $categoryId) { $login = new Login(); $content = $login->decode($contentEncoded->getContent(), $this->container, $user->getPassword()); $content['categoryId'] = $categoryId; $content['name'] = $contentEncoded->getName(); return $content; }
public function getListAction() { $contents = $this->getDoctrine()->getRepository('UniquePasswordBundle:Content')->findAll(); $listOfContents = array(); foreach ($contents as $content) { $loginContent = new Login(); $listOfContents[] = ['id' => $content->getId(), 'name' => $content->getName(), 'category' => $content->getCategory()->getName(), 'created' => $content->getCreated()->format('d/m/Y H:i:s'), 'modified' => $content->getModified()->format('d/m/Y H:i:s'), 'content' => $loginContent->decode($content->getContent(), $this->container, $this->getUser()->getPassword())]; } $response = new Response(); $response->setContent(json_encode($listOfContents)); $response->setStatusCode(Response::HTTP_OK); return $response; }