PHP Класс ActiveRecord\AbstractRelationship

См. также: http://www.phpactiverecord.org/guides/associations
Наследование: implements activerecord\InterfaceRelationship
Показать файл Открыть проект

Открытые свойства

Свойство Тип Описание
$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.

Защищенные свойства (Protected)

Свойство Тип Описание
$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 ( Table $from_table, boolean $using_through = false, string $alias = null ) : string 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 ( Table $table, $models, $attributes, $includes = [], $query_keys = [], $model_values_keys = [] ) : void 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 )

Описание методов

__construct() публичный Метод

Constructs a relationship.
public __construct ( array $options = [] ) : mixed
$options array Options for the relationship (see {@link valid_association_options})
Результат mixed

append_record_to_associate() защищенный Метод

protected append_record_to_associate ( activerecord\Model $associate, activerecord\Model $record )
$associate activerecord\Model
$record activerecord\Model

build_association() публичный Метод

Creates a new instance of specified {@link Model} with the attributes pre-loaded.
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

construct_inner_join_sql() публичный Метод

Creates INNER JOIN SQL for associations.
public construct_inner_join_sql ( Table $from_table, boolean $using_through = false, string $alias = null ) : string
$from_table 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

create_association() публичный Метод

Creates a new instance of {@link Model} and invokes save.
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

create_conditions_from_keys() защищенный Метод

protected create_conditions_from_keys ( activerecord\Model $model, $condition_keys = [], $value_keys = [] )
$model activerecord\Model

get_table() защищенный Метод

protected get_table ( )

is_poly() публичный Метод

What is this relationship's cardinality?
public is_poly ( ) : boolean
Результат boolean

load() абстрактный публичный Метод

This will load the related model data.
abstract public load ( activerecord\Model $model )
$model activerecord\Model The model this relationship belongs to

merge_association_options() защищенный Метод

protected merge_association_options ( $options )

set_class_name() защищенный Метод

protected set_class_name ( $class_name )

set_inferred_class_name() защищенный Метод

Will try to guess the appropriate class by singularizing and uppercasing $this->attribute_name.
См. также: attribute_name
protected set_inferred_class_name ( ) : void
Результат void

unset_non_finder_options() защищенный Метод

protected unset_non_finder_options ( $options )

Описание свойств

$attribute_name публичное свойство

Name to be used that will trigger call to the relationship.
public string $attribute_name
Результат string

$class_name публичное свойство

Class name of the associated model.
public string $class_name
Результат string

$foreign_key публичное свойство

Name of the foreign key.
public string $foreign_key
Результат string

$options защищенное свойство

Options of the relationship.
protected array $options
Результат array

$poly_relationship защищенное свойство

Is the relationship single or multi.
protected bool $poly_relationship
Результат boolean

$valid_association_options защищенное статическое свойство

List of valid options for relationships.
protected static array $valid_association_options
Результат array