| Methods |
public
|
__construct(string $foreignTable)
|
#
|
public
|
getMasterField(): Field
|
#
|
protected
|
createFakeForeignModel(): Model
Create fake foreign model, in the future, this method should be removed
in favor of always requiring an object model.
Create fake foreign model, in the future, this method should be removed
in favor of always requiring an object model.
|
#
|
public
|
getForeignModel(): Model
|
#
|
public
|
setOwner(Model $owner): $this
|
#
|
protected
|
onHookToOwnerBoth<T is Model>(
string $spot,
Closure(T, mixed, mixed, mixed, mixed, mixed, mixed, mixed, mixed, mixed, mixed): mixed $fx,
array<int, mixed> $args = [],
int $priority = 5,
): int
|
#
|
protected
|
onHookToOwnerEntity<T is Model>(
string $spot,
Closure(T, mixed, mixed, mixed, mixed, mixed, mixed, mixed, mixed, mixed, mixed): mixed $fx,
array<int, mixed> $args = [],
int $priority = 5,
): int
|
#
|
private
|
getModelTableString(Model $model): string
|
#
|
public
|
getDesiredName(): string
Will use either foreignAlias or #join-<table>.
Will use either foreignAlias or #join- .
|
#
|
protected
|
init(): void
|
#
|
protected
|
initJoinHooks(): void
|
#
|
private
|
getJoinNameFromShortName(): string
|
#
|
public
|
addField(string $name, array<mixed> $seed = []): Field
Adding field into join will automatically associate that field
with this join. That means it won't be loaded from …
Adding field into join will automatically associate that field
with this join. That means it won't be loaded from $table, but
form the join instead.
|
#
|
public
|
addFields(array<string, array<mixed>>|array<int, string> $fields = [], array<mixed> $seed = []): $this
Adds multiple fields.
|
#
|
public
|
join(string $foreignTable, array<string, mixed> $defaults = []): self
Another join will be attached to a current join.
Another join will be attached to a current join.
|
#
|
public
|
leftJoin(string $foreignTable, array<string, mixed> $defaults = []): self
Another leftJoin will be attached to a current join.
Another leftJoin will be attached to a current join.
|
#
|
public
|
hasOne(string $link, array<string, mixed> $defaults = []): HasOne
Creates reference based on a field from the join.
Creates reference based on a field from the join.
|
#
|
public
|
hasMany(string $link, array<string, mixed> $defaults = []): HasMany
Creates reference based on the field from the join.
Creates reference based on the field from the join.
|
#
|
public
|
getReverseJoins(): list<self>
|
#
|
protected
|
assertReferenceIdNotNull(mixed $value): void
|
#
|
protected
|
issetSaveBuffer(Model $entity): bool
|
#
|
protected
|
getAndUnsetReindexedSaveBuffer(Model $entity): array<string, mixed>
|
#
|
protected
|
setSaveBufferValue(Model $entity, string $fieldName, mixed $value): void
|
#
|
protected
|
unsetSaveBuffer(Model $entity): void
|
#
|
protected
|
afterLoad(Model $entity): void
|
#
|
protected
|
initSaveBuffer(Model $entity, bool $fromUpdate): void
|
#
|
private
|
getForeignIdFromEntity(Model $entity): mixed
|
#
|
protected
|
beforeInsert(Model $entity, array<string, mixed> &$data): void
|
#
|
private
|
setEntityValueAfterUpdate(Model $entity, string $field, mixed $value): void
|
#
|
protected
|
afterInsert(Model $entity): void
|
#
|
protected
|
beforeUpdate(Model $entity, array<string, mixed> &$data): void
|
#
|
protected
|
afterDelete(Model $entity): void
|
#
|
public
|
getOwner(): Model
|
#
|
| Properties |
protected
|
string
|
$foreignTable
Foreign table or WITH/CTE alias when used with SQL persistence.
Foreign table or WITH/CTE alias when used with SQL persistence.
|
#
|
public
|
?string
|
$foreignAlias = null
Alias for the joined table.
Alias for the joined table.
|
#
|
protected
|
?string
|
$kind = null
By default this will be either "inner" (for strong) or "left" for weak joins.
You can specify your own type of join…
By default this will be either "inner" (for strong) or "left" for weak joins.
You can specify your own type of join like "right".
|
#
|
public
|
bool
|
$weak = false
Weak join does not update foreign table.
Weak join does not update foreign table.
|
#
|
public
|
bool
|
$allowDangerousForeignTableUpdate = false
Foreign table is updated using fake model and thus no regular foreign model hooks are invoked.
Foreign table is updated using fake model and thus no regular foreign model hooks are invoked.
|
#
|
public
|
bool
|
$reverse = false
Normally the foreign table is saved first, then it's ID is used in the
primary table. When deleting, the primary table…
Normally the foreign table is saved first, then it's ID is used in the
primary table. When deleting, the primary table record is deleted first
which is followed by the foreign table record.
If you are using the following syntax:
$user->join('contact', 'default_contact_id')
Then the ID connecting tables is stored in foreign table and the order
of saving and delete needs to be reversed. In this case $reverse
will be set to true. You can specify value of this property.
|
#
|
public
|
?string
|
$masterField = null
Field to be used for matching inside master table.
By default it's $foreignTable . '_id'.
Field to be used for matching inside master table.
By default it's $foreignTable . '_id'.
|
#
|
public
|
?string
|
$foreignField = null
Field to be used for matching in a foreign table.
By default it's 'id'.
Field to be used for matching in a foreign table.
By default it's 'id'.
|
#
|
public
|
?string
|
$foreignIdField = null
Field to be used as foreign model ID field.
By default it's 'id'.
Field to be used as foreign model ID field.
By default it's 'id'.
|
#
|
protected
|
string
|
$prefix = ''
When $prefix is set, then all the fields generated through
our wrappers will be automatically prefixed inside the model.
When $prefix is set, then all the fields generated through
our wrappers will be automatically prefixed inside the model.
|
#
|
private
|
array<int, array<string, mixed>>
|
$saveBufferByOid = []
Data indexed by spl_object_id(entity) which is populated here as the save/insert progresses.
Data indexed by spl_object_id(entity) which is populated here as the save/insert progresses.
|
#
|
|