Свойство | Тип | Описание | |
---|---|---|---|
$attribute_name | string | Name to be used that will trigger call to the relationship. | |
$class_name | string | Class name of the associated model. | |
$foreign_key | string | Name of the foreign key. |
Свойство | Тип | Описание | |
---|---|---|---|
$options | array | Options of the relationship. | |
$poly_relationship | boolean | Is the relationship single or multi. | |
$valid_association_options | array | List of valid options for relationships. |
Метод | Описание | |
---|---|---|
__construct ( array $options = [] ) : mixed | Constructs a relationship. | |
build_association ( activerecord\Model $model, array $attributes = [], $guard_attributes = true ) : activerecord\Model | Creates a new instance of specified {@link Model} with the attributes pre-loaded. | |
construct_inner_join_sql ( |
Creates INNER JOIN SQL for associations. | |
create_association ( activerecord\Model $model, array $attributes = [], $guard_attributes = true ) : activerecord\Model | Creates a new instance of {@link Model} and invokes save. | |
is_poly ( ) : boolean | What is this relationship's cardinality? | |
load ( activerecord\Model $model ) | This will load the related model data. |
Метод | Описание | |
---|---|---|
append_record_to_associate ( activerecord\Model $associate, activerecord\Model $record ) | ||
create_conditions_from_keys ( activerecord\Model $model, $condition_keys = [], $value_keys = [] ) | ||
get_table ( ) | ||
merge_association_options ( $options ) | ||
query_and_attach_related_models_eagerly ( |
Eagerly loads relationships for $models. | |
set_class_name ( $class_name ) | ||
set_inferred_class_name ( ) : void | Infers the $this->class_name based on $this->attribute_name. | |
unset_non_finder_options ( $options ) |
public __construct ( array $options = [] ) : mixed | ||
$options | array | Options for the relationship (see {@link valid_association_options}) |
Результат | mixed |
protected append_record_to_associate ( activerecord\Model $associate, activerecord\Model $record ) | ||
$associate | activerecord\Model | |
$record | activerecord\Model |
public build_association ( activerecord\Model $model, array $attributes = [], $guard_attributes = true ) : activerecord\Model | ||
$model | activerecord\Model | The model which holds this association |
$attributes | array | Hash containing attributes to initialize the model with |
Результат | activerecord\Model |
public construct_inner_join_sql ( |
||
$from_table | the table used for the FROM SQL statement | |
$using_through | boolean | is this a THROUGH relationship? |
$alias | string | a table alias for when a table is being joined twice |
Результат | string | SQL INNER JOIN fragment |
public create_association ( activerecord\Model $model, array $attributes = [], $guard_attributes = true ) : activerecord\Model | ||
$model | activerecord\Model | The model which holds this association |
$attributes | array | Hash containing attributes to initialize the model with |
Результат | activerecord\Model |
protected create_conditions_from_keys ( activerecord\Model $model, $condition_keys = [], $value_keys = [] ) | ||
$model | activerecord\Model |
abstract public load ( activerecord\Model $model ) | ||
$model | activerecord\Model | The model this relationship belongs to |
protected set_inferred_class_name ( ) : void | ||
Результат | void |
public string $attribute_name | ||
Результат | string |
public string $class_name | ||
Результат | string |
public string $foreign_key | ||
Результат | string |
protected bool $poly_relationship | ||
Результат | boolean |
protected static array $valid_association_options | ||
Результат | array |