Added failing test cases for limit queries with with complex scalar order by items
This commit is contained in:
parent
a4ebc08c4f
commit
42bea80a6a
@ -5,6 +5,7 @@ namespace Doctrine\Tests\ORM\Tools\Pagination;
|
||||
use Doctrine\DBAL\Platforms\MySqlPlatform;
|
||||
use Doctrine\DBAL\Platforms\OraclePlatform;
|
||||
use Doctrine\DBAL\Platforms\PostgreSqlPlatform;
|
||||
use Doctrine\DBAL\Platforms\SQLServerPlatform;
|
||||
use Doctrine\ORM\Query;
|
||||
|
||||
class LimitSubqueryOutputWalkerTest extends PaginationTestCase
|
||||
@ -212,6 +213,36 @@ class LimitSubqueryOutputWalkerTest extends PaginationTestCase
|
||||
);
|
||||
}
|
||||
|
||||
public function testCountQueryWithComplexScalarOrderByItem()
|
||||
{
|
||||
$query = $this->entityManager->createQuery(
|
||||
'SELECT a FROM Doctrine\Tests\ORM\Tools\Pagination\Avatar a ORDER BY a.image_height * a.image_width DESC'
|
||||
);
|
||||
$this->entityManager->getConnection()->setDatabasePlatform(new MySqlPlatform());
|
||||
|
||||
$query->setHint(Query::HINT_CUSTOM_OUTPUT_WALKER, 'Doctrine\ORM\Tools\Pagination\LimitSubqueryOutputWalker');
|
||||
|
||||
$this->assertSame(
|
||||
'SELECT DISTINCT id_0, image_height_2, image_width_3 FROM (SELECT a0_.id AS id_0, a0_.image AS image_1, a0_.image_height AS image_height_2, a0_.image_width AS image_width_3, a0_.user_id AS user_id_4 FROM Avatar a0_) dctrn_result ORDER BY image_height_2 * image_width_3 DESC',
|
||||
$query->getSQL()
|
||||
);
|
||||
}
|
||||
|
||||
public function testCountQueryWithComplexScalarOrderByItemOracle()
|
||||
{
|
||||
$query = $this->entityManager->createQuery(
|
||||
'SELECT a FROM Doctrine\Tests\ORM\Tools\Pagination\Avatar a ORDER BY a.image_height * a.image_width DESC'
|
||||
);
|
||||
$this->entityManager->getConnection()->setDatabasePlatform(new OraclePlatform());
|
||||
|
||||
$query->setHint(Query::HINT_CUSTOM_OUTPUT_WALKER, 'Doctrine\ORM\Tools\Pagination\LimitSubqueryOutputWalker');
|
||||
|
||||
$this->assertSame(
|
||||
'SELECT DISTINCT ID_0, IMAGE_HEIGHT_2, IMAGE_WIDTH_3 FROM (SELECT a0_.id AS ID_0, a0_.image AS IMAGE_1, a0_.image_height AS IMAGE_HEIGHT_2, a0_.image_width AS IMAGE_WIDTH_3, a0_.user_id AS USER_ID_4 FROM Avatar a0_) dctrn_result ORDER BY IMAGE_HEIGHT_2 * IMAGE_WIDTH_3 DESC',
|
||||
$query->getSQL()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @group DDC-3434
|
||||
*/
|
||||
|
@ -145,3 +145,21 @@ class User
|
||||
*/
|
||||
public $groups;
|
||||
}
|
||||
|
||||
/** @Entity */
|
||||
class Avatar
|
||||
{
|
||||
/** @Id @column(type="integer") @generatedValue */
|
||||
public $id;
|
||||
/**
|
||||
* @OneToOne(targetEntity="User", inversedBy="avatar")
|
||||
* @JoinColumn(name="user_id", referencedColumnName="id")
|
||||
*/
|
||||
public $user;
|
||||
/** @column(type="string", length=255) */
|
||||
public $image;
|
||||
/** @column(type="integer") */
|
||||
public $image_height;
|
||||
/** @column(type="integer") */
|
||||
public $image_width;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user