Kdyby\Doctrine pri pouziti Paginator na tabulku ktora ma PK VARBINARY tak vracia empty Iterator
- duskohu
- Člen | 778
Caute, mam taky problem, mam tabulku kde mam PK VARBINARY a ked na neho pouzijem Paginator, tak mi to vrati empty Iterator, neviete mi poradit ako to riesit? Ked vypnem Paginator tak mi to ide.
/**
* @ORM\Id
* @ORM\Column(type="binary", length=16)
* @ORM\GeneratedValue(strategy="NONE")
*/
protected $id;
Nasledne mam klasicky QueryObject
<?php
use Kdyby\Doctrine\QueryObject;
use Kdyby\Persistence\Queryable;
class TourQuery extends QueryObject {
/**
* @param Queryable $repository
* @return \Doctrine\ORM\Query|\Doctrine\ORM\QueryBuilder
*/
protected function doCreateQuery(Queryable $repository) {
$qb = $this->createBasicDql($repository)
->addSelect('country, region');
return $qb;
}
/**
* @param Queryable $repository
* @return \Kdyby\Doctrine\QueryBuilder
*/
protected function doCreateCountQuery(Queryable $repository) {
return $this->createBasicDql($repository)->select('COUNT(DISTINCT q.id)');
}
/**
* @param Queryable $repository
* @return \Kdyby\Doctrine\QueryBuilder
*/
private function createBasicDql(Queryable $repository) {
$qb = $repository->createQueryBuilder()
->select('q')
->from(Tour::class, 'q')
->leftJoin('q.country', 'country')
->leftJoin('q.region', 'region');
return $qb;
}
}
a ked pouzijem Paginator tak mi to nic nevrati, ale ani error mi to neda, vrati empty Iterator
$query = new TourQuery();
$actionsList = $this->em->getRepository(Tour::class)->fetch($query);
$actionsList->applyPaging(0, 4);
ked sa pozriem na dump tak to podla mna sposobuje toto Resource id #3693 …
SELECT t0_.id AS id_0, t0_.publicity AS publicity_1, t0_.date_created AS date_created_2,
t0_.from_date AS from_date_3, t0_.to_date AS to_date_4, t0_.length AS length_5, t0_.provider AS
provider_6, t0_.price AS price_7, t0_.tax AS tax_8, t0_.total_price AS total_price_9, t0_.discount
AS discount_10, t0_.url AS url_11, t0_.images AS images_12, t0_.hotel AS hotel_13, t0_.hotel_path AS
hotel_path_14, t0_.country_name AS country_name_15, t0_.region_name AS region_name_16, t0_.food AS
food_17, t0_.food_id AS food_id_18, t0_.transportation AS transportation_19, t0_.transportation_id
AS transportation_id_20, t0_.airports AS airports_21, t0_.has_region AS has_region_22, t0_.term_type
AS term_type_23, t0_.term_type_id AS term_type_id_24, t0_.tour_types AS tour_types_25,
t0_.hotel_info AS hotel_info_26, l1_.id AS id_27, l1_.lft AS lft_28, l1_.lvl AS lvl_29, l1_.rgt AS
rgt_30, l1_.title AS title_31, l1_.path AS path_32, l1_.location_type AS location_type_33, l2_.id AS
id_34, l2_.lft AS lft_35, l2_.lvl AS lvl_36, l2_.rgt AS rgt_37, l2_.title AS title_38, l2_.path AS
path_39, l2_.location_type AS location_type_40, t0_.country_id AS country_id_41, t0_.region_id AS
region_id_42, l1_.root AS root_43, l1_.parent_id AS parent_id_44, l2_.root AS root_45, l2_.parent_id
AS parent_id_46
FROM tours t0_
LEFT JOIN locations l1_ ON t0_.country_id = l1_.id
LEFT JOIN locations l2_ ON t0_.region_id = l2_.id
WHERE t0_.id IN ('Resource id #3693', 'Resource id #3695', 'Resource id #3697', 'Resource id #3699')
ORDER BY t0_.discount DESC
Editoval duskohu (9. 1. 2018 22:49)