mini\Database\Attributes\ForeignKey class

Documentation

Specifies foreign key relationship

Inspired by Entity Framework Core's [ForeignKey] attribute.

Can be applied to either the foreign key property or the navigation property.

Example on foreign key property:

#[ForeignKey(navigation: 'user')]
public int $user_id;

public User $user;

Example on navigation property:

public int $user_id;

#[ForeignKey(property: 'user_id', references: 'users.id')]
public User $user;

Properties (5)

public ?string $property
public ?string $navigation
public ?string $references
public string $onDelete
public string $onUpdate

Methods (1)

Documentation missing

Source

src/Database/Attributes/ForeignKey.php:29-46