src/Sedona/SBORuntimeBundle/Datatable/Data/DatatableQuery.php
private function setIdentifierFromAssociation($association, $key = '', $i = 0, $metadata = null)
    {
        if (null === $metadata) {
            $metadata = $this->metadata;
        }

        if (is_string($association)) {
            $targetEntityClass = $metadata->getAssociationTargetClass($association);
            $targetMetadata = $this->getMetadata($targetEntityClass);
            $this->selectColumns[$association][] = $this->getIdentifier($targetMetadata);
        }

        if (is_array($association) && array_key_exists($i, $association)) {
            $column = $association[$i];
            $count = count($association) - 1;
            if (true === $metadata->hasAssociation($column)) {
                $targetEntityClass = $metadata->getAssociationTargetClass($column);
                $targetMetadata = $this->getMetadata($targetEntityClass);
                if ($count == $i) {
                    $this->selectColumns[$key][] = $this->getIdentifier($targetMetadata);
                } else {
                    ++$i;
                    $this->setIdentifierFromAssociation($association, $key, $i, $targetMetadata);
                }
            }
        }

        return $this;
    }
private function setIdentifierFromAssociation($association, $key = '', $i = 0, $metadata = null)
    {
        if (null === $metadata) {
            $metadata = $this->metadata;
        }

        if (is_string($association)) {
            $targetEntityClass = $metadata->getAssociationTargetClass($association);
            $targetMetadata = $this->getMetadata($targetEntityClass);
            $this->selectColumns[$association][] = $this->getIdentifier($targetMetadata);
        }

        if (is_array($association) && array_key_exists($i, $association)) {
            $column = $association[$i];
            $count = count($association) - 1;
            if (true === $metadata->hasAssociation($column)) {
                $targetEntityClass = $metadata->getAssociationTargetClass($column);
                $targetMetadata = $this->getMetadata($targetEntityClass);
                if ($count == $i) {
                    $this->selectColumns[$key][] = $this->getIdentifier($targetMetadata);
                } else {
                    ++$i;
                    $this->setIdentifierFromAssociation($association, $key, $i, $targetMetadata);
                }
            }
        }

        return $this;
    }
private function setIdentifierFromAssociation ( $ association , $ key = '' , $ i = 0 , $ metadata = null ) { if ( null === $ metadata ) { $ metadata = $ this -> metadata ; } if ( is_string ( $ association ) ) { $ targetEntityClass = $ metadata -> getAssociationTargetClass ( $ association ) ; $ targetMetadata = $ this -> getMetadata ( $ targetEntityClass ) ; $ this -> selectColumns [ $ association ] [ ] = $ this -> getIdentifier ( $ targetMetadata ) ; } if ( is_array ( $ association ) && array_key_exists ( $ i , $ association ) ) { $ column = $ association [ $ i ] ; $ count = count ( $ association ) - 1 ; if ( true === $ metadata -> hasAssociation ( $ column ) ) { $ targetEntityClass = $ metadata -> getAssociationTargetClass ( $ column ) ; $ targetMetadata = $ this -> getMetadata ( $ targetEntityClass ) ; if ( $ count == $ i ) { $ this -> selectColumns [ $ key ] [ ] = $ this -> getIdentifier ( $ targetMetadata ) ; } else { ++ $ i ; $ this -> setIdentifierFromAssociation ( $ association , $ key , $ i , $ targetMetadata ) ; } } } return $ this ; }
Set identifier from association.

@param string|array       $association
@param string             $key
@param int                $i
@param ClassMetadata|null $metadata

@return $this

@throws \Exception
Set identifier from association .