Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * @property int $id {primary}
- * @property string $username
- * @property-read string $passwordHash
- * @property-write string $password {virtual}
- * @property-read DateTimeImmutable $createdAt {virtual}
- * @property-read DateTimeImmutable $updatedAt {virtual}
- *
- * @property AuthorEntity $author {1:1 AuthorEntity::$user}
- */
- class UserEntity extends Entity
- {
- public static function construct(string $username, string $password): self
- {
- $obj = new self();
- $obj->username = $username;
- $obj->password = $password;
- return $obj;
- }
- public function setterPassword(string $password)
- {
- $this->setReadOnlyValue('passwordHash', Authenticator::generatePasswordHash($password));
- }
- }
Add Comment
Please, Sign In to add comment