Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ function shouldBeHandledByQueryHintByPassingCount()
{
$p = new Paginator;
$em = $this->getMockSqliteEntityManager();
$this->populate($em);

$count = $em
->createQuery('SELECT COUNT(c) FROM Test\Fixture\Entity\Composite c')
Expand All @@ -27,15 +28,45 @@ function shouldBeHandledByQueryHintByPassingCount()
->createQuery('SELECT c FROM Test\Fixture\Entity\Composite c')
->setHint('knp_paginator.count', $count)
;
$query->setHint(Query::HINT_CUSTOM_OUTPUT_WALKER, false);
$query->setHint(UsesPaginator::HINT_FETCH_JOIN_COLLECTION, false);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so if run test with $query->setHint(Query::HINT_CUSTOM_OUTPUT_WALKER, false); and populate fixtures we should get Single id is not allowed on composite primary key in entity [...] ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if you "should" get that in the sense of expected behavior, but that's what is happening.

$view = $p->paginate($query, 1, 10, array('wrap-queries' => true));

$items = $view->getItems();
$this->assertEquals(0, count($items));
$this->assertEquals(4, count($items));
}

protected function getUsedEntityFixtures()
{
return array('Test\Fixture\Entity\Composite');
}

private function populate($em)
{
$summer = new Composite;
$summer->setId(1);
$summer->setTitle('summer');
$summer->setUid(100);

$winter = new Composite;
$winter->setId(2);
$winter->setTitle('winter');
$winter->setUid(200);

$autumn = new Composite;
$autumn->setId(3);
$autumn->setTitle('autumn');
$autumn->setUid(300);

$spring = new Composite;
$spring->setId(4);
$spring->setTitle('spring');
$spring->setUid(400);

$em->persist($summer);
$em->persist($winter);
$em->persist($autumn);
$em->persist($spring);
$em->flush();
}

}