Generate then complete Book
aml make:entity Booksrc/models/Book.php
<?php
declare(strict_types=1);
namespace App\Models;
use AML\Data\Entity;
use AML\Data\Metadata\{Key, Table};
#[Table('books')]
final class Book extends Entity
{
#[Key]
public int $id;
public string $title;
public string $author;
}Read every element
#[Table('books')]maps the class to the books table
extends Entitymakes the class persistable by Data
#[Key]marks the primary key
public string $titledescribes a required text value
Why does the identifier have no value?
Before insertion, the book does not exist in the table. The database generates its key; DbSet::add() then writes it back to $book->id. The same PHP object now knows its persisted identity.
An entity is not a table
The class describes the PHP-side shape. The migration actually creates database structure. Both must stay coherent.