Skip to content

Instantly share code, notes, and snippets.

@CHH
Last active December 23, 2017 13:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CHH/3a7056f71663659c41f82f0f082dd0b3 to your computer and use it in GitHub Desktop.
Save CHH/3a7056f71663659c41f82f0f082dd0b3 to your computer and use it in GitHub Desktop.
<?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