source/Spiral/ORM/Entities/Relations/ManyToMorphedRelation.php
public function getVariation(string $variation): ManyToManyRelation
    {
        if (isset($this->nested[$variation])) {
            return $this->nested[$variation];
        }

        if (!isset($this->schema[Record::MORPHED_ALIASES][$variation])) {
            throw new RelationException("Undefined morphed variation '{$variation}'");
        }

        $class = $this->schema[Record::MORPHED_ALIASES][$variation];

        $relation = new ManyToManyRelation(
            $class,
            $this->makeSchema($class),
            $this->orm,
            $this->orm->define($class, ORMInterface::R_ROLE_NAME)
        );

        return $this->nested[$variation] = $relation->withContext($this->parent, false);
    }
public function getVariation(string $variation): ManyToManyRelation
    {
        if (isset($this->nested[$variation])) {
            return $this->nested[$variation];
        }

        if (!isset($this->schema[Record::MORPHED_ALIASES][$variation])) {
            throw new RelationException("Undefined morphed variation '{$variation}'");
        }

        $class = $this->schema[Record::MORPHED_ALIASES][$variation];

        $relation = new ManyToManyRelation(
            $class,
            $this->makeSchema($class),
            $this->orm,
            $this->orm->define($class, ORMInterface::R_ROLE_NAME)
        );

        return $this->nested[$variation] = $relation->withContext($this->parent, false);
    }
public function getVariation ( string $ variation ) : ManyToManyRelation { if ( isset ( $ this -> nested [ $ variation ] ) ) { return $ this -> nested [ $ variation ] ; } if ( ! isset ( $ this -> schema [ Record :: MORPHED_ALIASES ] [ $ variation ] ) ) { throw new RelationException ( "Undefined morphed variation '{$variation}'" ) ; } $ class = $ this -> schema [ Record :: MORPHED_ALIASES ] [ $ variation ] ; $ relation = new ManyToManyRelation ( $ class , $ this -> makeSchema ( $ class ) , $ this -> orm , $ this -> orm -> define ( $ class , ORMInterface :: R_ROLE_NAME ) ) ; return $ this -> nested [ $ variation ] = $ relation -> withContext ( $ this -> parent , false ) ; }
Get nested relation for a given variation.

@param string $variation

@return ManyToManyRelation

@throws RelationException
Get nested relation for a given variation .