vendor/sonata-project/user-bundle/src/Entity/BaseUser.php line 21

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. /*
  4.  * This file is part of the Sonata Project package.
  5.  *
  6.  * (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
  7.  *
  8.  * For the full copyright and license information, please view the LICENSE
  9.  * file that was distributed with this source code.
  10.  */
  11. namespace Sonata\UserBundle\Entity;
  12. use Sonata\UserBundle\Model\User as AbstractedUser;
  13. /**
  14.  * Represents a Base User Entity.
  15.  */
  16. class BaseUser extends AbstractedUser
  17. {
  18.     /**
  19.      * Hook on pre-persist operations.
  20.      */
  21.     public function prePersist(): void
  22.     {
  23.         $this->createdAt = new \DateTime();
  24.         $this->updatedAt = new \DateTime();
  25.     }
  26.     /**
  27.      * Hook on pre-update operations.
  28.      */
  29.     public function preUpdate(): void
  30.     {
  31.         $this->updatedAt = new \DateTime();
  32.     }
  33. }