PHP Класс LMongo\Eloquent\Relations\HasOneOrMany

Наследование: extends Relation
Показать файл Открыть проект Примеры использования класса

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

Свойство Тип Описание
$foreignKey string The foreign key of the parent model.

Открытые методы

Метод Описание
__construct ( Builder $query, Model $parent, string $foreignKey ) : void Create a new has many relationship instance.
addConstraints ( ) : void Set the base constraints on the relation query.
addEagerConstraints ( array $models ) : void Set the constraints for an eager load of the relation.
create ( array $attributes ) : Model Create a new instance of the related model.
createMany ( array $records ) : array Create an array of new instances of the related model.
getForeignKey ( ) : string Get the foreign key for the relationship.
matchMany ( array $models, Collection $results, string $relation ) : array Match the eagerly loaded results to their many parents.
matchOne ( array $models, Collection $results, string $relation ) : array Match the eagerly loaded results to their single parents.
save ( Model $model ) : Model Attach a model instance to the parent model.
saveMany ( array $models ) : array Attach an array of models to the parent instance.
update ( array $attributes ) : integer Perform an update on all the related models.

Защищенные методы

Метод Описание
buildDictionary ( Collection $results ) : array Build model dictionary keyed by the relation's foreign key.
getRelationValue ( array $dictionary, string $key, string $type ) Get the value of a relationship by one or many type.
matchOneOrMany ( array $models, Collection $results, string $relation, string $type ) : array Match the eagerly loaded results to their many parents.

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

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

Create a new has many relationship instance.
public __construct ( Builder $query, Model $parent, string $foreignKey ) : void
$query LMongo\Eloquent\Builder
$parent LMongo\Eloquent\Model
$foreignKey string
Результат void

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

Set the base constraints on the relation query.
public addConstraints ( ) : void
Результат void

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

Set the constraints for an eager load of the relation.
public addEagerConstraints ( array $models ) : void
$models array
Результат void

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

Build model dictionary keyed by the relation's foreign key.
protected buildDictionary ( Collection $results ) : array
$results LMongo\Eloquent\Collection
Результат array

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

Create a new instance of the related model.
public create ( array $attributes ) : Model
$attributes array
Результат LMongo\Eloquent\Model

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

Create an array of new instances of the related model.
public createMany ( array $records ) : array
$records array
Результат array

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

Get the foreign key for the relationship.
public getForeignKey ( ) : string
Результат string

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

Get the value of a relationship by one or many type.
protected getRelationValue ( array $dictionary, string $key, string $type )
$dictionary array
$key string
$type string

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

Match the eagerly loaded results to their many parents.
public matchMany ( array $models, Collection $results, string $relation ) : array
$models array
$results LMongo\Eloquent\Collection
$relation string
Результат array

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

Match the eagerly loaded results to their single parents.
public matchOne ( array $models, Collection $results, string $relation ) : array
$models array
$results LMongo\Eloquent\Collection
$relation string
Результат array

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

Match the eagerly loaded results to their many parents.
protected matchOneOrMany ( array $models, Collection $results, string $relation, string $type ) : array
$models array
$results LMongo\Eloquent\Collection
$relation string
$type string
Результат array

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

Attach a model instance to the parent model.
public save ( Model $model ) : Model
$model LMongo\Eloquent\Model
Результат LMongo\Eloquent\Model

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

Attach an array of models to the parent instance.
public saveMany ( array $models ) : array
$models array
Результат array

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

Perform an update on all the related models.
public update ( array $attributes ) : integer
$attributes array
Результат integer

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

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

The foreign key of the parent model.
protected string $foreignKey
Результат string