doctrine/doctrine2 — pull request #462 by beberlei (2012-10-03 10:37:20+00:00)
Title: [DDC-2055] Generate SELECT clause from ResultSetMappingBuilder

Add support to generate entity result parts of the SELECT clause from a ResultSetMappingBuilder instance. Add support for column incrementing.

Sample:

public function testGenerateSelectClauseIncrement()
{
$rsm = new ResultSetMappingBuilder($this->_em);
$rsm->addRootEntityFromClassMetadata('Doctrine\Tests\Models\CMS\CmsUser', 'u', ResultSetMappingBuilder::COLUMN_RENAMING_INCREMENT);

$selectClause = $rsm->generateSelectClause();

$this->assertEquals('u.id AS id0, u.status AS status1, u.username AS username2, u.name AS name3, u.email_id AS email_id4', $selectClause);
}

Restrictions:

This only generates the entity result clauses, not the ones for scalar results! Because we don't know what the scalar result actually means.