» API Reference » ORM\Relation\Owner
ORM\Relation\Owner
Table of Contents
Abstract
Extends: ORM\Relation
Owner Relation
Methods
ORM\Relation\Owner::__construct
public function __construct(string $class, array $reference)
Owner constructor.
Parameters
Parameter |
Type |
Description |
$class |
string |
|
$reference |
array |
|
ORM\Relation\Owner::__construct
↑ top
ORM\Relation\Owner::addJoin
public function addJoin(
\ORM\EntityFetcher $fetcher,
mixed $join,
mixed $alias,
): mixed
{@inheritdoc}
Parameters
ORM\Relation\Owner::addJoin
↑ top
public function addRelated(
\ORM\Entity $self,
\ORM\Entity[] $entities,
\ORM\EntityManager $entityManager,
): mixed
Add $entities to association table
Parameters
ORM\Relation\Owner::addRelated
↑ top
ORM\Relation\Owner::apply
public function apply(\ORM\EntityFetcher $fetcher, \ORM\Entity $entity): mixed
Apply where conditions for $entity on $fetcher
Called from non-owner to find related elements. Example:
$user->fetch(‘articles’) creates an EntityFetcher for Article and calls
$opponent->apply($fetcher, $user) that will call
$fetcher->where(‘authorId’, $user->id)
Parameters
ORM\Relation\Owner::apply
↑ top
ORM\Relation\Owner::applyJoin
public function applyJoin(
\ORM\QueryBuilder\Parenthesis $join,
string $yourAlias,
\ORM\Relation\OneToMany $opponent,
): mixed
Adds the join clause to the entity fetcher
Parameters
ORM\Relation\Owner::applyJoin
↑ top
ORM\Relation\Owner::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\Owner::createRelation
↑ top
public function deleteRelated(
\ORM\Entity $self,
\ORM\Entity[] $entities,
\ORM\EntityManager $entityManager,
): mixed
Delete $entities from association table
Parameters
ORM\Relation\Owner::deleteRelated
↑ top
ORM\Relation\Owner::eagerLoad
public function eagerLoad(\ORM\EntityManager $em, \ORM\Entity $entities): mixed
Load this relation for all $entities with one query
Parameters
ORM\Relation\Owner::eagerLoad
↑ top
ORM\Relation\Owner::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\Owner::fetch
↑ top
ORM\Relation\Owner::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\Owner::fetchAll
↑ top
ORM\Relation\Owner::fromShort
public static function fromShort(mixed $parent, array $short): mixed
{@inheritDoc}
Static |
|
This method is static. |
Returns |
mixed |
|
Parameters
Parameter |
Type |
Description |
$parent |
mixed |
|
$short |
array |
|
ORM\Relation\Owner::fromShort
↑ top
ORM\Relation\Owner::getReference
public function getReference(): mixed
ORM\Relation\Owner::getReference
↑ top
public function setRelated(
\ORM\Entity $self,
\ORM\Entity|null $entity = null,
): mixed
Set the relation to $entity
Parameters
ORM\Relation\Owner::setRelated
↑ top