public function load(QueryBuilder $query, ClassMetadata $metadata)
    {
        $field = $this->mapping['fieldname'];
        $boltname = $metadata->getBoltName();
        $table = $this->mapping['tables']['field_value'];

        $from = $query->getQueryPart('from');

        if (isset($from[0]['alias'])) {
            $alias = $from[0]['alias'];
        } else {
            $alias = $from[0]['table'];
        }

        $subQuery = '(SELECT ' . $this->getPlatformGroupConcat($query) . " FROM $table f WHERE f.content_id = $alias.id AND f.contenttype='$boltname' AND f.name = '$field') as $field";
        $query->addSelect($subQuery);

        return null;
    }
public function load(QueryBuilder $query, ClassMetadata $metadata)
    {
        $field = $this->mapping['fieldname'];
        $boltname = $metadata->getBoltName();
        $table = $this->mapping['tables']['field_value'];

        $from = $query->getQueryPart('from');

        if (isset($from[0]['alias'])) {
            $alias = $from[0]['alias'];
        } else {
            $alias = $from[0]['table'];
        }

        $subQuery = '(SELECT ' . $this->getPlatformGroupConcat($query) . " FROM $table f WHERE f.content_id = $alias.id AND f.contenttype='$boltname' AND f.name = '$field') as $field";
        $query->addSelect($subQuery);

        return null;
    }
public function load ( QueryBuilder $ query , ClassMetadata $ metadata ) { $ field = $ this -> mapping [ 'fieldname' ] ; $ boltname = $ metadata -> getBoltName ( ) ; $ table = $ this -> mapping [ 'tables' ] [ 'field_value' ] ; $ from = $ query -> getQueryPart ( 'from' ) ; if ( isset ( $ from [ 0 ] [ 'alias' ] ) ) { $ alias = $ from [ 0 ] [ 'alias' ] ; } else { $ alias = $ from [ 0 ] [ 'table' ] ; } $ subQuery = '(SELECT ' . $ this -> getPlatformGroupConcat ( $ query ) . " FROM $table f WHERE f.content_id = $alias.id AND f.contenttype='$boltname' AND f.name = '$field') as $field" ; $ query -> addSelect ( $ subQuery ) ; return null ; }
For repeating fields, the load method adds extra joins and selects to
the query that fetches the related records from the field and field
value tables in the same query as the content fetch.

@param QueryBuilder  $query
@param ClassMetadata $metadata

@return QueryBuilder|null
For repeating fields the load method adds extra joins and selects to the query that fetches the related records from the field and field value tables in the same query as the content fetch .