1
0
mirror of synced 2024-12-14 15:16:04 +03:00

Merge branch 'DDC-968'

This commit is contained in:
Benjamin Eberlei 2011-01-23 16:47:20 +01:00
commit be2e00c991
2 changed files with 23 additions and 0 deletions

View File

@ -458,6 +458,16 @@ abstract class AbstractQuery
return isset($this->_hints[$name]) ? $this->_hints[$name] : false;
}
/**
* Return the key value map of query hints that are currently set.
*
* @return array
*/
public function getHints()
{
return $this->_hints;
}
/**
* Executes the query and returns an IterableResult that can be used to incrementally
* iterate over the result.

View File

@ -86,4 +86,17 @@ class QueryTest extends \Doctrine\Tests\OrmTestCase
$this->assertSame($q2, $q);
}
/**
* @group DDC-968
*/
public function testHints()
{
$q = $this->_em->createQuery("select a from Doctrine\Tests\Models\CMS\CmsArticle a");
$q->setHint('foo', 'bar')->setHint('bar', 'baz');
$this->assertEquals('bar', $q->getHint('foo'));
$this->assertEquals('baz', $q->getHint('bar'));
$this->assertEquals(array('foo' => 'bar', 'bar' => 'baz'), $q->getHints());
}
}