» API Reference » ORM\Relation
ORM\Relation
Table of Contents
Abstract
Base Relation
Constants
Name |
Value |
OPT_CLASS |
'class' |
OPT_MORPH_COLUMN |
'morphColumn' |
OPT_MORPH |
'morph' |
OPT_REFERENCE |
'reference' |
OPT_CARDINALITY |
'cardinality' |
OPT_OPPONENT |
'opponent' |
OPT_TABLE |
'table' |
OPT_FILTERS |
'filters' |
CARDINALITY_ONE |
'one' |
CARDINALITY_MANY |
'many' |
Methods
public function addRelated(
\ORM\Entity $self,
\ORM\Entity[] $entities,
\ORM\EntityManager $entityManager,
): mixed
Add $entities to association table
Parameters
ORM\Relation::addRelated
↑ top
ORM\Relation::createRelation
public static function createRelation(
string $parent,
string $name,
array $relDef,
): \ORM\Relation
Factory for relation definition object
Parameters
Parameter |
Type |
Description |
$parent |
string |
|
$name |
string |
|
$relDef |
array |
|
ORM\Relation::createRelation
↑ top
public function deleteRelated(
\ORM\Entity $self,
\ORM\Entity[] $entities,
\ORM\EntityManager $entityManager,
): mixed
Delete $entities from association table
Parameters
ORM\Relation::deleteRelated
↑ top
ORM\Relation::eagerLoad
public function eagerLoad(\ORM\EntityManager $em, \ORM\Entity $entities): mixed
Load this relation for all $entities with one query
Parameters
ORM\Relation::eagerLoad
↑ top
ORM\Relation::fetch
abstract public function fetch(
\ORM\Entity $self,
\ORM\EntityManager $entityManager,
): mixed
Fetch the relation
Runs fetch on the EntityManager and returns its result.
Parameters
ORM\Relation::fetch
↑ top
ORM\Relation::fetchAll
public function fetchAll(
\ORM\Entity $self,
\ORM\EntityManager $entityManager,
): \ORM\Entity[]|\ORM\Entity
Fetch all from the relation
Runs fetch and returns EntityFetcher::all() if a Fetcher is returned.
Parameters
ORM\Relation::fetchAll
↑ top
public function setRelated(
\ORM\Entity $self,
\ORM\Entity|null $entity = null,
): mixed
Set the relation to $entity
Parameters
ORM\Relation::setRelated
↑ top