Last active
December 12, 2015 10:59
-
-
Save hpatoio/4762796 to your computer and use it in GitHub Desktop.
User class with property password_changed_at
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| namespace Hpatoio\UserBundle\Entity; | |
| use FOS\UserBundle\Entity\User as BaseUser; | |
| use Doctrine\ORM\Mapping as ORM; | |
| /** | |
| * @ORM\Entity | |
| * @ORM\Table(name="fos_user") | |
| */ | |
| class User extends BaseUser | |
| { | |
| /** | |
| * @ORM\Id | |
| * @ORM\Column(type="integer") | |
| * @ORM\GeneratedValue(strategy="AUTO") | |
| */ | |
| protected $id; | |
| /** | |
| * @var date_time | |
| * | |
| * @ORM\Column(name="password_changed_at", type="datetime") | |
| */ | |
| protected $password_changed_at; | |
| public function __construct() | |
| { | |
| parent::__construct(); | |
| $today = new \DateTime(); | |
| $this->setPasswordChangedAt($today); | |
| } | |
| public function setPlainPassword($password) | |
| { | |
| $today = new \DateTime(); | |
| $this->setPasswordChangedAt($today); | |
| parent::setPlainPassword($password); | |
| } | |
| /** | |
| * @var date_time | |
| * | |
| * @ORM\Column(name="password_changed_at", type="datetime") | |
| */ | |
| protected $password_changed_at; | |
| /** | |
| * Set password_changed_at | |
| * | |
| * @param \DateTime $passwordChangedAt | |
| * @return User | |
| */ | |
| public function setPasswordChangedAt($passwordChangedAt) | |
| { | |
| $this->password_changed_at = $passwordChangedAt; | |
| return $this; | |
| } | |
| /** | |
| * Get password_changed_at | |
| * | |
| * @return \DateTime | |
| */ | |
| public function getPasswordChangedAt() | |
| { | |
| return $this->password_changed_at; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment