Class: BelongsTo
Full name: Azera\Orm\Attribute\BelongsTo
Many-to-one: THIS model's table holds the foreign key.
Property name = relation name. Defaults: foreignKey = property name +
'_id' (e.g. property author → author_id), ownerKey = target's first
ID field.
Default load strategy: SQL JOIN (to-one is always JOIN).
Public Properties
Public methods
__construct() ·
public function __construct(string $target, string|null $foreignKey = null, string|null $ownerKey = null): mixed
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$target |
string | - | |
$foreignKey |
string|null | null |
|
$ownerKey |
string|null | null |
Return value
- Type:
mixed