Symfony 用户密码未更新:easyadminbundle
我用的是easyadmin和fosuserbundle。 问题是,每次我尝试更新(更改)用户密码时,什么都没有发生,相同的旧密码仍然相同。我想我可能错过了一些配置 Config.ymlSymfony 用户密码未更新:easyadminbundle,symfony,symfony-3.2,symfony-3.1,symfony2-easyadmin,Symfony,Symfony 3.2,Symfony 3.1,Symfony2 Easyadmin,我用的是easyadmin和fosuserbundle。 问题是,每次我尝试更新(更改)用户密码时,什么都没有发生,相同的旧密码仍然相同。我想我可能错过了一些配置 Config.yml easyadmin: Admin: class: AppBundle\Entity\User form: fields: - username
easyadmin:
Admin:
class: AppBundle\Entity\User
form:
fields:
- username
- email
- { property: 'plainPassword' , type: 'text'}
User.php:
<?php
// src/AppBundle/Entity/User.php
namespace AppBundle\Entity;
use FOS\UserBundle\Model\User as BaseUser;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Symfony\Component\Security\Core\Util\SecureRandom;
use Symfony\Component\HttpFoundation\File\File;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
use Doctrine\Common\Collections\ArrayCollection;
/**
* @ORM\Entity
* @ORM\Table(name="fos_user")
*/
/**
* @Vich\Uploadable
* @ORM\Entity()
* @ORM\HasLifecycleCallbacks()
* @ORM\Table(name="user")
*
* @UniqueEntity("email")
*
*/
class User extends BaseUser
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @ORM\Column(type="string", length=255,nullable=true)
*
*/
public $nom;
/**
* @ORM\Column(type="string",nullable=true,length=255,nullable=true)
*/
public $prenom;
/**
* @ORM\Column(type="string",nullable=true,length=255,nullable=true)
*/
public $adresse;
/**
* @ORM\Column(type="string", length=255,nullable=true)
*
* @Assert\Range(
* min = 00000000,
* max = 99999999,minMessage="Entrer un numero de cin correct svp",maxMessage="Entrer un numero tel correct svp"
* )
*/
protected $phone;
/**
* @var Devise[]
*
* @ORM\OneToMany(targetEntity="Devise", mappedBy="buyer")
*/
private $purchases;
/**
* The creation date of the product.
*
* @var \DateTime
* @ORM\Column(type="datetime", name="created_at")
*/
private $createdAt = null;
public function __construct()
{
parent::__construct();
// your own logic
$this->purchases = new ArrayCollection();
$this->createdAt = new \DateTime();
}
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set referance
*
* @param string $referance
*
*/
public function setReferance($referance )
{if($this->referance==NULL) $referance ='2';
$this->referance = $referance ;
return $this;
}
/**
* Get referance
*
* @return string
*/
public function getReferance ()
{
return $this->referance ;
}
/**
* Set forename
*
* @param string $forname
* @return User
*/
public function setForename($forename)
{
$this->forname = $forename;
return $this;
}
/**
* Get forename
*
* @return string
*/
public function getForename()
{
return $this->forname;
}
/**
* Asks whether the user is granted a particular role
*
* @return boolean
*/
public function isGranted($role)
{
return in_array($role, $this->getRoles());
}
/**
* Set nickname
*
* @param string $nickname
* @return User
*/
public function setNickname($nickname)
{
$this->nickname = $nickname;
return $this;
}
/**
* Get nickname
*
* @return string
*/
public function getNickname()
{
return $this->nickname;
}
/**
* Set lastEdited
*
* @param \DateTime $lastEdited
* @return User
*/
public function setLastEdited($lastEdited)
{
$this->lastEdited = $lastEdited;
return $this;
}
/**
* Get lastEdited
*
* @return \DateTime
*/
public function getLastEdited()
{
return $this->lastEdited;
}
/**
* @ORM\PrePersist()
* @ORM\PreUpdate()
*/
public function setLastEditedValueAsNow() {
$this->setLastEdited(new \DateTime());
}
/**
* Set surname
*
* @param string $surname
* @return User
*/
public function setSurname($surname)
{
$this->surname = $surname;
return $this;
}
/**
* Get surname
*
* @return string
*/
public function getSurname()
{
return $this->surname;
}
/**
* Set updatedAt
*
* @param \DateTime $updatedAt
*
* @return Utilisateurs
*/
public function setUpdatedAt($updatedAt)
{
$this->updatedAt = $updatedAt;
return $this;
}
/**
* Get updatedAt
*
* @return \DateTime
*/
public function getUpdatedAt()
{
return $this->updatedAt;
}
public function __toString()
{if ($this->prenom != null && $this->nom!= null && $this->phone != null) {
return 'prenom&nom :'.$this->prenom.' '.$this->nom.' | phone : '.$this->phone ;
}
else return 'id :'.$this->id.' | username : '.$this->username ; }
/**
* Set nom
*
* @param string $nom
*
* @return Utilisateurs
*/
public function setNom($nom)
{
$this->nom = $nom;
return $this;
}
/**
* Get nom
*
* @return string
*/
public function getNom()
{
return $this->nom;
}
/**
* Set prenom
*
* @param string $prenom
*
* @return Utilisateurs
*/
public function setPrenom($prenom)
{
$this->prenom = $prenom;
return $this;
}
/**
* Get prenom
*
* @return string
*/
public function getPrenom()
{
return $this->prenom;
}
/**
* Set ville
*
* @param string $ville
*
* @return Utilisateurs
*/
public function setVille($ville)
{
$this->ville = $ville;
return $this;
}
/**
* Get ville
*
* @return string
*/
public function getVille()
{
return $this->ville;
}
/**
* Set class
*
* @param string $class
*
* @return Utilisateurs
*/
public function setClass($class)
{
$this->class = $class;
return $this;
}
/**
* Get class
*
* @return string
*/
public function getClass()
{
return $this->class;
}
/**
* Set phone
*
* @param string $phone
*
* @return Utilisateurs
*/
public function setPhone($phone)
{
$this->phone = $phone;
return $this;
}
/**
* Get phone
*
* @return string
*/
public function getPhone()
{
return $this->phone;
}
/**
* Add purchase
*
* @param \AppBundle\Entity\Devise $purchase
*
* @return User
*/
public function addPurchase(\AppBundle\Entity\Devise $purchase)
{
$this->purchases[] = $purchase;
return $this;
}
/**
* Remove purchase
*
* @param \AppBundle\Entity\Devise $purchase
*/
public function removePurchase(\AppBundle\Entity\Devise $purchase)
{
$this->purchases->removeElement($purchase);
}
/**
* Get purchases
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getPurchases()
{
return $this->purchases;
}
/**
* Set adresse
*
* @param string $adresse
*
* @return User
*/
public function setAdresse($adresse)
{
$this->adresse = $adresse;
return $this;
}
/**
* Get adresse
*
* @return string
*/
public function getAdresse()
{
return $this->adresse;
}
/**
* Set createdAt
*
* @param \DateTime $createdAt
*
* @return User
*/
public function setCreatedAt($createdAt)
{
$this->createdAt = $createdAt;
return $this;
}
/**
* Get createdAt
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->createdAt;
}
public function serialize()
{
return serialize(array(
$this->id,
$this->username,
$this->password,
));
}
public function unserialize($serialized)
{
list(
$this->id,
$this->username,
$this->password) = unserialize($serialized);
}
}
purchases=newarraycollection();
$this->createdAt=new\DateTime();
}
/**
*取得身份证
*
*@返回整数
*/
公共函数getId()
{
返回$this->id;
}
/**
*集合引用
*
*@param string$reference
*
*/
公共函数设置引用($reference)
{if($this->reference==NULL)$reference='2';
$this->reference=$reference;
退还$this;
}
/**
*获得推荐
*
*@返回字符串
*/
公共函数getReference()
{
返回$this->reference;
}
/**
*定名
*
*@param string$forname
*@返回用户
*/
公共函数setForename($forename)
{
$this->forname=$forename;
退还$this;
}
/**
*取名
*
*@返回字符串
*/
公共函数getForename()
{
返回$this->forname;
}
/**
*询问用户是否被授予特定角色
*
*@返回布尔值
*/
已授予公共功能($role)
{
返回数组($role,$this->getRoles());
}
/**
*设置昵称
*
*@param string$昵称
*@返回用户
*/
公共函数set昵称($昵称)
{
$this->nickname=$nickname;
退还$this;
}
/**
*取绰号
*
*@返回字符串
*/
公共函数get昵称()
{
返回$this->昵称;
}
/**
*最后编辑集
*
*@param\DateTime$lastEdit
*@返回用户
*/
公共函数setLastEdited($lastEdited)
{
$this->lastpedited=$lastpedited;
退还$this;
}
/**
*最后编辑
*
*@return\DateTime
*/
公共函数getLastEdited()
{
返回$this->lastdedited;
}
/**
*@ORM\PrePersist()
*@ORM\PreUpdate()
*/
公共函数setLastEditedValueAsNow(){
$this->setlastpedited(new\DateTime());
}
/**
*定姓
*
*@param string$姓氏
*@返回用户
*/
公共函数setSurname($姓氏)
{
$this->姓氏=$lasname;
退还$this;
}
/**
*姓
*
*@返回字符串
*/
公共函数getname()
{
返回$this->姓氏;
}
/**
*设置更新日期
*
*@param\DateTime$updatedAt
*
*@返回用户
*/
公共函数setUpdatedAt($updatedAt)
{
$this->updatedAt=$updatedAt;
退还$this;
}
/**
*更新
*
*@return\DateTime
*/
公共函数getUpdatedAt()
{
返回$this->updatedAt;
}
公共函数
{如果($this->prenom!=null&&$this->nom!=null&&$this->phone!=null){
返回'prenom&nom:'。$this->prenom.'.$this->nom.| phone:'。$this->phone;
}
否则返回“id:”。$this->id.| username:“。$this->username;}
/**
*定名
*
*@param字符串$nom
*
*@返回用户
*/
公共函数setNom($nom)
{
$this->nom=$nom;
退还$this;
}
/**
*取名
*
*@返回字符串
*/
公共函数getNom()
{
返回$this->nom;
}
/**
*设置prenom
*
*@param字符串$prenom
*
*@返回用户
*/
公共函数setPrenom($prenom)
{
$this->prenom=$prenom;
退还$this;
}
/**
*获取prenom
*
*@返回字符串
*/
公共函数getPrenom()
{
返回$this->prenom;
}
/**
*塞特维尔
*
*@param string$ville
*
*@返回用户
*/
公共职能部门
{
$this->ville=$ville;
退还$this;
}
/**
*得到维尔
*
*@返回字符串
*/
公共函数getVille()
{
返回$this->ville;
}
/**
*定级
*
*@param string$class
*
*@返回用户
*/
公共函数setClass($class)
{
$this->class=$class;
退还$this;
}
/**
*上课
*
*@返回字符串
*/
公共函数getClass()
{
返回$this->class;
}
/**
*固定电话
*
*@param string$phone
*
*@返回用户
*/
公共功能设置电话($phone)
{
$this->phone=$phone;
退还$this;
}
/**
*接电话
*
*@返回字符串
*/
公共函数getPhone()
{
返回$this->phone;
}
/**
*添加购买
*
*@param\AppBundle\Entity\designe$purchase
*
*@返回用户
*/
公共功能addPurchase(\AppBundle\Entity\Desive$purchase)
{
$this->purchases[]=$purchase;
退还$this;
}
/**
*取消购买
*
*@param\AppBundle\Entity\designe$purchase
*/
公共功能removePurchase(\AppBundle\Entity\Desive$purchase)
{
$this->purchases->removelement($purchase);
}
/**
*购买
*
*@return\doctor\Common\Collections\Collection
*/
公共函数getPurchases()
{
返回$this->purchases;
}
/**
*集合地址
*
*@param string$adrese
*
*@返回用户
*/
公共功能设置地址($ADRESE)
{
$this->adrese=$adrese;
退还$this;
}
/**
*取得地址
*
*@返回字符串
*/