/** * This method is responsible for updating an existing content * into the database * * @param stdObject $entryContent contains the content that has been passed * by the form * @param UniquePasswordBundle\Category\{Login|CreditCard|Note} $type object to * be constructed * @param Symfony\Bundle\FrameworkBundle\Controller $user */ private function updateContent($id, $entryContent, $type, $user) { $dateNow = new \DateTime(); $content = $this->em->getRepository('UniquePasswordBundle:Content')->find($id); $content->setName($entryContent->name); $encodedContent = $type->encode($this->container, $user->getPassword()); $content->setContent($encodedContent); $content->setModified($dateNow); $this->em->persist($content); $this->em->flush(); }