Ejemplo n.º 1
0
 public function updateAction(Request $request, User $user)
 {
     $em = $this->getDoctrine()->getManager();
     $entity = $em->getRepository('WellnessCoreBundle:User')->find($user->getId());
     if (!$entity) {
         throw $this->createNotFoundException('Unable to find User entity.');
     }
     $deleteForm = $this->createDeleteForm($user->getId());
     $editForm = $this->createEditForm($entity);
     $editForm->handleRequest($request);
     if ($editForm->isValid()) {
         $factory = $this->get('security.encoder_factory');
         $encoder = $factory->getEncoder($entity);
         $password = $encoder->encodePassword($editForm->get('password')->getData(), $entity->getSalt());
         $entity->setPassword($password);
         $em->flush();
         return $this->redirect($this->generateUrl('admin_user'));
     }
     return $this->render('WellnessCoreBundle:BackEnd/User:edit.html.twig', array('entity' => $entity, 'edit_form' => $editForm->createView(), 'delete_form' => $deleteForm->createView()));
 }
Ejemplo n.º 2
0
 /**
  * Constructor
  */
 public function __construct()
 {
     parent::__construct();
     $this->CategoryService = new \Doctrine\Common\Collections\ArrayCollection();
 }
Ejemplo n.º 3
0
 /**
  * Constructor
  */
 public function __construct()
 {
     parent::__construct();
 }