lib/Doctrine/ORM/Query/ResultSetMapping.php
public function addIndexBy($alias, $fieldName)
    {
        $found = false;

        foreach (array_merge($this->metaMappings, $this->fieldMappings) as $columnName => $columnFieldName) {
            if (! ($columnFieldName === $fieldName && $this->columnOwnerMap[$columnName] === $alias)) {
                continue;
            }

            $this->addIndexByColumn($alias, $columnName);
            $found = true;

            break;
        }

        /* TODO: check if this exception can be put back, for now it's gone because of assumptions made by some ORM internals
        if ( ! $found) {
            $message = sprintf(
                'Cannot add index by for DQL alias %s and field %s without calling addFieldResult() for them before.',
                $alias,
                $fieldName
            );

            throw new \LogicException($message);
        }
        */

        return $this;
    }
public function addIndexBy($alias, $fieldName)
    {
        $found = false;

        foreach (array_merge($this->metaMappings, $this->fieldMappings) as $columnName => $columnFieldName) {
            if (! ($columnFieldName === $fieldName && $this->columnOwnerMap[$columnName] === $alias)) {
                continue;
            }

            $this->addIndexByColumn($alias, $columnName);
            $found = true;

            break;
        }

        /* TODO: check if this exception can be put back, for now it's gone because of assumptions made by some ORM internals
        if ( ! $found) {
            $message = sprintf(
                'Cannot add index by for DQL alias %s and field %s without calling addFieldResult() for them before.',
                $alias,
                $fieldName
            );

            throw new \LogicException($message);
        }
        */

        return $this;
    }
public function addIndexBy ( $ alias , $ fieldName ) { $ found = false ; foreach ( array_merge ( $ this -> metaMappings , $ this -> fieldMappings ) as $ columnName => $ columnFieldName ) { if ( ! ( $ columnFieldName === $ fieldName && $ this -> columnOwnerMap [ $ columnName ] === $ alias ) ) { continue ; } $ this -> addIndexByColumn ( $ alias , $ columnName ) ; $ found = true ; break ; } /* TODO: check if this exception can be put back, for now it's gone because of assumptions made by some ORM internals
        if ( ! $found) {
            $message = sprintf(
                'Cannot add index by for DQL alias %s and field %s without calling addFieldResult() for them before.',
                $alias,
                $fieldName
            );

            throw new \LogicException($message);
        }
        */ return $ this ; }
Sets a field to use for indexing an entity result or joined entity result.

@param string $alias     The alias of an entity result or joined entity result.
@param string $fieldName The name of the field to use for indexing.

@return ResultSetMapping This ResultSetMapping instance.
Sets a field to use for indexing an entity result or joined entity result .