tflori/orm

just another orm...

View the Project on GitHub tflori/orm

Build Status Test Coverage Maintainability Latest Stable Version Total Downloads

» API Reference » ORM\Relation\ManyToMany

ORM\Relation\ManyToMany

Table of Contents

Abstract

Extends: ORM\Relation

ManyToMany Relation

Methods

ORM\Relation\ManyToMany::__construct

public function __construct(
    string $class, 
    array $reference, 
    string $opponent, 
    string $table, 
    \ORM\EntityFetcher\FilterInterface[]|callable[] $filters = [], 
)
ManyToMany constructor.
Parameters
Parameter Type Description  
$class string    
$reference array    
$opponent string    
$table string    
$filters **ORM\EntityFetcher\FilterInterface[] callable[]**  

ORM\Relation\ManyToMany::__construct

↑ top


ORM\Relation\ManyToMany::addJoin

public function addJoin(
    \ORM\EntityFetcher $fetcher, 
    mixed $join, 
    mixed $alias, 
): mixed
{@inheritdoc}
Returns mixed  
Parameters
Parameter Type Description
$fetcher ORM\EntityFetcher  
$join mixed  
$alias mixed  

ORM\Relation\ManyToMany::addJoin

↑ top


ORM\Relation\ManyToMany::addRelated

public function addRelated(
    \ORM\Entity $self, 
    \ORM\Entity[] $entities, 
    \ORM\EntityManager $entityManager, 
): mixed
Add $entities to association table
Returns mixed  
Throws ORM\Exception\InvalidRelation  
Parameters
Parameter Type Description
$self ORM\Entity  
$entities ORM\Entity[]  
$entityManager ORM\EntityManager  

ORM\Relation\ManyToMany::addRelated

↑ top


ORM\Relation\ManyToMany::createRelation

public static function createRelation(
    string $parent, 
    string $name, 
    array $relDef, 
): \ORM\Relation
Factory for relation definition object
Static   This method is static.
Returns ORM\Relation  
Throws ORM\Exception\InvalidConfiguration  
Parameters
Parameter Type Description
$parent string  
$name string  
$relDef array  

ORM\Relation\ManyToMany::createRelation

↑ top


ORM\Relation\ManyToMany::deleteRelated

public function deleteRelated(
    \ORM\Entity $self, 
    \ORM\Entity[] $entities, 
    \ORM\EntityManager $entityManager, 
): mixed
Delete $entities from association table
Returns mixed  
Throws ORM\Exception\InvalidRelation  
Parameters
Parameter Type Description
$self ORM\Entity  
$entities ORM\Entity[]  
$entityManager ORM\EntityManager  

ORM\Relation\ManyToMany::deleteRelated

↑ top


ORM\Relation\ManyToMany::eagerLoad

public function eagerLoad(\ORM\EntityManager $em, \ORM\Entity $entities): mixed
Load this relation for all $entities with one query
Returns mixed  
Parameters
Parameter Type Description
$em ORM\EntityManager  
$entities ORM\Entity  

ORM\Relation\ManyToMany::eagerLoad

↑ top


ORM\Relation\ManyToMany::fetch

abstract public function fetch(
    \ORM\Entity $self, 
    \ORM\EntityManager $entityManager, 
): mixed
Fetch the relation

Runs fetch on the EntityManager and returns its result.

Returns mixed  
Parameters
Parameter Type Description
$self ORM\Entity  
$entityManager ORM\EntityManager  

ORM\Relation\ManyToMany::fetch

↑ top


ORM\Relation\ManyToMany::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.

Returns ORM\Entity[]|ORM\Entity  
Parameters
Parameter Type Description
$self ORM\Entity  
$entityManager ORM\EntityManager  

ORM\Relation\ManyToMany::fetchAll

↑ top


ORM\Relation\ManyToMany::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\ManyToMany::fromShort

↑ top


ORM\Relation\ManyToMany::getReference

public function getReference(): mixed
Returns mixed  

ORM\Relation\ManyToMany::getReference

↑ top


ORM\Relation\ManyToMany::getTable

public function getTable(): string
Returns string  

ORM\Relation\ManyToMany::getTable

↑ top


ORM\Relation\ManyToMany::setRelated

public function setRelated(
    \ORM\Entity $self, 
    \ORM\Entity|null $entity = null, 
): mixed
Set the relation to $entity
Returns mixed  
Throws ORM\Exception\InvalidRelation  
Parameters
Parameter Type Description  
$self ORM\Entity    
$entity **ORM\Entity null**  

ORM\Relation\ManyToMany::setRelated

↑ top