1
0
mirror of synced 2024-12-05 03:06:05 +03:00

problem with LimitSubqueryOutputWalker when use InheritanceType

Conflicts:
	tests/Doctrine/Tests/OrmFunctionalTestCase.php
This commit is contained in:
Alexander Orabey 2015-03-25 20:51:17 +03:00 committed by Marco Pivetta
parent ff75a3ad49
commit f92307d06d
4 changed files with 65 additions and 0 deletions

View File

@ -0,0 +1,27 @@
<?php
namespace Doctrine\Tests\Models\Pagination;
/**
* @package Doctrine\Tests\Models\Pagination
*
* @Entity
* @Table(name="pagination_user")
* @InheritanceType("SINGLE_TABLE")
* @DiscriminatorColumn(name="type", type="string")
* @DiscriminatorMap({"user1"="User1"})
*/
abstract class User
{
/**
* @Id @Column(type="integer")
* @GeneratedValue
*/
private $id;
/**
* @Column(type="string")
*/
public $name;
}

View File

@ -0,0 +1,17 @@
<?php
namespace Doctrine\Tests\Models\Pagination;
/**
* Class User1
* @package Doctrine\Tests\Models\Pagination
*
* @Entity()
*/
class User1 extends User
{
/**
* @Column(type="string")
*/
public $email;
}

View File

@ -10,6 +10,7 @@ use Doctrine\ORM\Tools\Pagination\Paginator;
use Doctrine\Tests\Models\Pagination\Company;
use Doctrine\Tests\Models\Pagination\Department;
use Doctrine\Tests\Models\Pagination\Logo;
use Doctrine\Tests\Models\Pagination\User1;
use ReflectionMethod;
/**
@ -440,6 +441,16 @@ class PaginationTest extends \Doctrine\Tests\OrmFunctionalTestCase
$this->iterateWithOrderDescWithLimitAndOffset(true, $fetchJoinCollection, $dql, "name");
}
/**
* @dataProvider fetchJoinCollection
*/
public function testIterateWithOutputWalkersWithFetchJoinWithComplexOrderByReferencingJoinedWithLimitAndOffsetWithInheritanceType($fetchJoinCollection)
{
$dql = 'SELECT u FROM Doctrine\Tests\Models\Pagination\User u ORDER BY u.id';
$this->iterateWithOrderAscWithLimit(true, $fetchJoinCollection, $dql, "name");
$this->iterateWithOrderDescWithLimit(true, $fetchJoinCollection, $dql, "name");
}
public function testIterateComplexWithOutputWalker()
{
$dql = 'SELECT g, COUNT(u.id) AS userCount FROM Doctrine\Tests\Models\CMS\CmsGroup g LEFT JOIN g.users u GROUP BY g HAVING COUNT(u.id) > 0';
@ -663,6 +674,13 @@ class PaginationTest extends \Doctrine\Tests\OrmFunctionalTestCase
$this->_em->persist($company);
}
for ($i = 0; $i < 9; $i++) {
$user = new User1();
$user->name = "name$i";
$user->email = "email$i";
$this->_em->persist($user);
}
$this->_em->flush();
}

View File

@ -271,6 +271,8 @@ abstract class OrmFunctionalTestCase extends OrmTestCase
'Doctrine\Tests\Models\Pagination\Company',
'Doctrine\Tests\Models\Pagination\Logo',
'Doctrine\Tests\Models\Pagination\Department',
'Doctrine\Tests\Models\Pagination\User',
'Doctrine\Tests\Models\Pagination\User1',
),
);
@ -524,6 +526,7 @@ abstract class OrmFunctionalTestCase extends OrmTestCase
$conn->executeUpdate('DELETE FROM pagination_logo');
$conn->executeUpdate('DELETE FROM pagination_department');
$conn->executeUpdate('DELETE FROM pagination_company');
$conn->executeUpdate('DELETE FROM pagination_user');
}
$this->_em->clear();