# Ulmus Welcome to the official Ulmus documentation. ## Quick start Creating a simple user entity: */app/entity/user.php* ```php "user") */ class User { use \Ulmus\EntityTrait; /** * @Id */ public int $id; /** * @Field */ public string $fullname; /** * @Field */ public ? string $email; /** * @Field('name' => 'is_admin') */ public bool $isAdmin = false; /** * @DateTime */ public Datetime $birthday; } ``` ### Loading a user using a Primary Key With this entity, we could quickly load a user using the `@Id` field using: ```php $user = Entity\User::repository()->loadFromPk((int) $_GET['id']); ``` Or we could also, load another single entity using a specific field: ```php # fetch a single user $user = Entity\User::repository()->loadOneFromField((string) $_POST['email'], 'email'); # Fetch every admins $admin_list = Entity\User::repository()->loadFromField(true, 'isAdmin'); ``` Using the same entity class, we could create a new user and save it using: ```php $user = new Entity\User(); $user->fullname = "Johnny Does"; $user->birthday = "1980-01-15"; if ( Entity\User::repository()->save($user) ) { echo "User created successfully !"; } else { echo "User could not be saved :\"; } ``` Which would result in the following query (from MySQL adapter) being generated and executed : ```SQL INSERT INTO `user` VALUES fullname = :fullname, birthday = :birthday; ``` Binded using: ```PHP 'fullname' => "Johnny Does", 'birthday' => "1980-01-15", ```