Last active
December 23, 2017 13:04
-
-
Save CHH/3a7056f71663659c41f82f0f082dd0b3 to your computer and use it in GitHub Desktop.
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 | |
use ORM\{Entity, Field, Id, AutoIncrement}; | |
use Validators\{MaxLength, Email, NotEmpty}; | |
use Auth\{EncodePassword}; | |
class User attributes( | |
Entity(table = 'users') | |
) | |
{ | |
private $id attributes( | |
Field(type = 'int'), | |
Id(), | |
AutoIncrement(), | |
); | |
private $username attributes(Field(type = 'string'), NotEmpty()); | |
private $password attributes( | |
Field(type = 'string'), | |
EncodePassword(), | |
NotEmpty(), | |
); | |
private $displayName attributes( | |
Field(type = 'string', length = 255), | |
MaxLength(255), | |
); | |
private $email attributes( | |
Field(type = 'string'), Email(), MaxLength(255) | |
); | |
private $homepage attributes( | |
Field(type = 'string'), MaxLength(255) | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment