| Methods |
private
|
_addField(
string $fieldName,
bool $theirFieldIsTitle,
($theirFieldIsTitle is true ? null : string) $theirFieldName,
array<string, mixed> $defaults,
): SqlExpressionField
|
#
|
public
|
addField(string $fieldName, string $theirFieldName = null, array<string, mixed> $defaults = []): SqlExpressionField
Creates expression which sub-selects a field inside related model.
Creates expression which sub-selects a field inside related model.
|
#
|
public
|
addFields(array<string, array<mixed>>|array<int, string> $fields = [], array<string, mixed> $defaults = []): $this
Add multiple expressions by calling addField several times. Fields
may contain 3 types of elements:.
Add multiple expressions by calling addField several times. Fields
may contain 3 types of elements:.
['name', 'surname'] - will import those fields as-is
['full_name' => 'name', 'day_of_birth' => ['dob', 'type' => 'date']] - use alias and options
[['dob', 'type' => 'date']] - use options
|
#
|
public
|
refLink(Model $ourModel, array<string, mixed> $defaults = []): Model
Creates model that can be used for generating sub-query actions.
Creates model that can be used for generating sub-query actions.
|
#
|
public
|
ref(Model $ourModel, array $defaults = []): Model
If our model is loaded, then return their model with respective loaded entity.
If our model is loaded, then return their model with respective loaded entity.
If our model is not loaded, then return their model with condition set.
This can happen in case of deep traversal $model->ref('Many')->ref('one_id'), for example.
Overrides
|
#
|
public
|
addTitle(array<string, mixed> $defaults = []): SqlExpressionField
Add a title of related entity as expression to our field.
Add a title of related entity as expression to our field.
$order->hasOne('user_id', 'User')->addTitle();
This will add expression 'user' equal to ref('user_id')['name'];
|
#
|