Kullanıcıları yönetmek için symfony2 CRUD jeneratörü kullanıyorum. Veritabanında güncellenmeyen kullanıcı şifresini güncellediğimde çok nadir bir durum oluyor. Ancak kullanıcı şifresini isim veya e-posta gibi başka alanlarla güncellediğimde şifre güncellenir.FOS kullanıcı güncelleme şifresi nadir durumda çalışmıyor
Benim UserType Formu sınıfı Nihayet
/**
* Edits an existing User entity.
*
* @Route("/{id}", name="user_update")
* @Method("PUT")
* @Template("ArsPlaybookBundle:User:edit.html.twig")
*/
public function updateAction(Request $request, $id) {
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository('ArsPlaybookBundle:User')->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find User entity.');
}
$deleteForm = $this->createDeleteForm($id);
$editForm = $this->createEditForm($entity);
$email=$request->request->all();
$password = $email['ars_playbookbundle_user']['plainPassword'];
if(isset($password)){
$editForm->get('plainPassword')->setData($password);
}
$editForm->handleRequest($request);
//\Doctrine\Common\Util\Debug::dump($editForm->getData()); die;
if ($editForm->isValid()) {
$entity->upload();
$em->flush();
$this->get('session')->getFlashBag()->add(
'notice', 'Your changes were saved!'
);
return $this->redirect($this->generateUrl('user_edit', array('id' => $id)));
}
return array(
'entity' => $entity,
'edit_form' => $editForm->createView(),
'delete_form' => $deleteForm->createView(),
);
}