assume entity namespace when not given
This commit is contained in:
parent
3aa8d3fdac
commit
de93983dff
File diff suppressed because it is too large
Load Diff
@ -129,6 +129,30 @@ class NewOperatorTest extends \Doctrine\Tests\OrmFunctionalTestCase
|
||||
$this->assertEquals($this->fixtures[2]->address->city, $result[2]->address);
|
||||
}
|
||||
|
||||
public function testShouldAssumeFromEntityNamespaceWhenNotGiven()
|
||||
{
|
||||
$dql = "
|
||||
SELECT
|
||||
new CmsUserDTO(u.name, e.email, a.city)
|
||||
FROM
|
||||
Doctrine\Tests\Models\CMS\CmsUser u
|
||||
JOIN
|
||||
u.email e
|
||||
JOIN
|
||||
u.address a
|
||||
ORDER BY
|
||||
u.name";
|
||||
|
||||
$query = $this->_em->createQuery($dql);
|
||||
$result = $query->getResult();
|
||||
|
||||
$this->assertCount(3, $result);
|
||||
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUserDTO', $result[0]);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUserDTO', $result[1]);
|
||||
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUserDTO', $result[2]);
|
||||
}
|
||||
|
||||
public function testShouldSupportLiteralExpression()
|
||||
{
|
||||
$dql = "
|
||||
@ -403,11 +427,11 @@ class NewOperatorTest extends \Doctrine\Tests\OrmFunctionalTestCase
|
||||
{
|
||||
$dql = "
|
||||
SELECT
|
||||
new Doctrine\Tests\Models\CMS\CmsUserDTO(
|
||||
new CmsUserDTO(
|
||||
u.name,
|
||||
e.email
|
||||
),
|
||||
new Doctrine\Tests\Models\CMS\CmsAddressDTO(
|
||||
new CmsAddressDTO(
|
||||
a.country,
|
||||
a.city
|
||||
)
|
||||
@ -473,7 +497,7 @@ class NewOperatorTest extends \Doctrine\Tests\OrmFunctionalTestCase
|
||||
|
||||
/**
|
||||
* @expectedException Doctrine\ORM\Query\QueryException
|
||||
* @expectedExceptionMessage [Semantical Error] line 0, col 68 near ') FROM Doctrine\Tests\Models\CMS\CmsUser': Error: Number of arguments does not match.
|
||||
* @expectedExceptionMessage [Semantical Error] line 0, col 11 near 'Doctrine\Tests\ORM\Functional\ClassWithTooMuchArgs(u.name)': Error: Number of arguments does not match with "Doctrine\Tests\ORM\Functional\ClassWithTooMuchArgs" constructor declaration.
|
||||
*/
|
||||
public function testInvalidClassWithoutConstructorException()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user