PHP Class LMongo\Eloquent\Relations\Relation

Datei anzeigen Open project: navruzm/lmongo Class Usage Examples

Protected Properties

Property Type Description
$parent LMongo\Eloquent\Model The parent model instance.
$query LMongo\Eloquent\Builder The Eloquent query builder instance.
$related LMongo\Eloquent\Model The related model instance.

Public Methods

Method Description
__call ( string $method, array $parameters ) : mixed Handle dynamic method calls to the relationship.
__construct ( Builder $query, Model $parent ) : void Create a new relation 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.
createdAt ( ) : string Get the name of the "created at" column.
getAndResetWheres ( ) : array Remove the original where clause set by the relationship.
getBaseQuery ( ) : Builder Get the base query builder driving the Eloquent builder.
getParent ( ) : Model Get the parent model of the relation.
getQuery ( ) : Builder Get the underlying query for the relation.
getRelated ( ) : Model Get the related model of the relation.
getResults ( ) : mixed Get the results of the relationship.
initRelation ( array $models, string $relation ) : void Initialize the relation on a set of models.
match ( array $models, Collection $results, string $relation ) : array Match the eagerly loaded results to their parents.
rawUpdate ( array $attributes = [] ) : integer Run a raw update against the base query.
relatedUpdatedAt ( ) : string Get the name of the related model's "updated at" column.
restore ( ) : integer Restore all of the soft deleted related models.
touch ( ) : void Touch all of the related models for the relationship.
updatedAt ( ) : string Get the name of the "updated at" column.

Protected Methods

Method Description
getKeys ( array $models ) : array Get all of the primary keys for an array of models.
removeFirstWhereClause ( ) : void Remove the first where clause from the relationship query.
removeSecondWhereClause ( ) : void Remove the second where clause from the relationship query.

Method Details

__call() public method

Handle dynamic method calls to the relationship.
public __call ( string $method, array $parameters ) : mixed
$method string
$parameters array
return mixed

__construct() public method

Create a new relation instance.
public __construct ( Builder $query, Model $parent ) : void
$query LMongo\Eloquent\Builder
$parent LMongo\Eloquent\Model
return void

addConstraints() abstract public method

Set the base constraints on the relation query.
abstract public addConstraints ( ) : void
return void

addEagerConstraints() abstract public method

Set the constraints for an eager load of the relation.
abstract public addEagerConstraints ( array $models ) : void
$models array
return void

createdAt() public method

Get the name of the "created at" column.
public createdAt ( ) : string
return string

getAndResetWheres() public method

The remaining constraints on the query will be reset and returned.
public getAndResetWheres ( ) : array
return array

getBaseQuery() public method

Get the base query builder driving the Eloquent builder.
public getBaseQuery ( ) : Builder
return LMongo\Query\Builder

getKeys() protected method

Get all of the primary keys for an array of models.
protected getKeys ( array $models ) : array
$models array
return array

getParent() public method

Get the parent model of the relation.
public getParent ( ) : Model
return LMongo\Eloquent\Model

getQuery() public method

Get the underlying query for the relation.
public getQuery ( ) : Builder
return LMongo\Eloquent\Builder

getRelated() public method

Get the related model of the relation.
public getRelated ( ) : Model
return LMongo\Eloquent\Model

getResults() abstract public method

Get the results of the relationship.
abstract public getResults ( ) : mixed
return mixed

initRelation() abstract public method

Initialize the relation on a set of models.
abstract public initRelation ( array $models, string $relation ) : void
$models array
$relation string
return void

match() abstract public method

Match the eagerly loaded results to their parents.
abstract public match ( array $models, Collection $results, string $relation ) : array
$models array
$results LMongo\Eloquent\Collection
$relation string
return array

rawUpdate() public method

Run a raw update against the base query.
public rawUpdate ( array $attributes = [] ) : integer
$attributes array
return integer

relatedUpdatedAt() public method

Get the name of the related model's "updated at" column.
public relatedUpdatedAt ( ) : string
return string

removeFirstWhereClause() protected method

Remove the first where clause from the relationship query.
protected removeFirstWhereClause ( ) : void
return void

removeSecondWhereClause() protected method

Remove the second where clause from the relationship query.
protected removeSecondWhereClause ( ) : void
return void

restore() public method

Restore all of the soft deleted related models.
public restore ( ) : integer
return integer

touch() public method

Touch all of the related models for the relationship.
public touch ( ) : void
return void

updatedAt() public method

Get the name of the "updated at" column.
public updatedAt ( ) : string
return string

Property Details

$parent protected_oe property

The parent model instance.
protected Model,LMongo\Eloquent $parent
return LMongo\Eloquent\Model

$query protected_oe property

The Eloquent query builder instance.
protected Builder,LMongo\Eloquent $query
return LMongo\Eloquent\Builder