src/Entity/Identity/Password.php line 17

  1. <?php
  2. namespace App\Entity\Identity;
  3. use App\Entity\Common;
  4. use Doctrine\DBAL\Types\Types;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Gedmo\Mapping\Annotation as Gedmo;
  7. use Symfony\Component\Validator\Constraints as Assert;
  8. #[ORM\Table(name'user_password')]
  9. #[ORM\Index(columns: ['user_id'], name'user_password_user_id_idx')]
  10. #[ORM\Index(columns: ['created_by'], name'user_password_created_by_idx')]
  11. #[ORM\Index(columns: ['updated_by'], name'user_password_updated_by_idx')]
  12. #[ORM\UniqueConstraint(name'user_password_user_value_key'columns: ['user_id''value'])]
  13. #[ORM\Entity]
  14. class Password
  15. {
  16.     use Common\Blameable;
  17.     use Common\Trackable;
  18.     #[ORM\Id]
  19.     #[ORM\GeneratedValue(strategy'IDENTITY')]
  20.     #[ORM\SequenceGenerator(sequenceName'user_password_id_seq')]
  21.     #[ORM\Column(typeTypes::INTEGER)]
  22.     private ?int $id null;
  23.     #[Assert\NotNull]
  24.     #[ORM\ManyToOne(targetEntityUser::class, inversedBy'oldPasswords')]
  25.     #[ORM\JoinColumn(name'user_id'nullablefalse)]
  26.     private ?User $user null;
  27.     #[Assert\NotBlank]
  28.     #[Assert\Type(typeTypes::STRING)]
  29.     #[ORM\Column(typeTypes::STRING)]
  30.     private ?string $value null;
  31.     #[Assert\Type(typeTypes::BOOLEAN)]
  32.     #[ORM\Column(typeTypes::BOOLEANnullabletrueoptions: ['default' => false])]
  33.     private ?bool $expired false;
  34.     #[Gedmo\Blameable(on'create')]
  35.     #[ORM\ManyToOne(targetEntityUser::class)]
  36.     #[ORM\JoinColumn(name'created_by')]
  37.     protected ?User $createdBy null;
  38.     public function getId(): ?int
  39.     {
  40.         return $this->id;
  41.     }
  42.     public function getUser(): ?User
  43.     {
  44.         return $this->user;
  45.     }
  46.     public function setUser(?User $user): self
  47.     {
  48.         $this->user $user;
  49.         return $this;
  50.     }
  51.     public function getValue(): ?string
  52.     {
  53.         return $this->value;
  54.     }
  55.     public function setValue(?string $value): self
  56.     {
  57.         $this->value $value;
  58.         return $this;
  59.     }
  60.     public function isExpired(): ?bool
  61.     {
  62.         return $this->expired;
  63.     }
  64.     public function setExpired(?bool $expired): self
  65.     {
  66.         $this->expired $expired;
  67.         return $this;
  68.     }
  69. }