DDC-1803: Paginator usage with a DQL query that is using 2 time the same named binded value failed #2268

Closed
opened 2026-01-22 13:46:49 +01:00 by admin · 4 comments
Owner

Originally created by @doctrinebot on GitHub (Apr 30, 2012).

Originally assigned to: @Ocramius on GitHub.

Jira issue originally created by user mdrolet:

I use a dql query where I bind a named parameter 2 time in the same query for different joined fields. The query work but the count query failed saying that there are missing bind variable.

ex:
$qb = $this->getQueryBuilder()
->select('
partial fl.{id, title, listing_date, abstract},
partial fla.{id},
partial ca.{id},
partial ds.{id}
')
->from('Fo_Listing', 'fl')
->join('fl.listing_properties', 'flp')
->join('flp.property', 'fp')
->leftjoin('fl.listing_assets', 'fla')
->leftjoin('fla.asset', 'ca')
->leftjoin('ca.ds', 'ds')
->where('fp.id = :propertyId')
->setParameter('propertyId', $id)
->andWhere('fl.object_status_id <> :deleted')
->setParameter('deleted', CoRefObjectStatus::DELETE)
->andWhere('fl.publishing_status_id = :published')
->setParameter('published', CoRefPublishingStatus::PUBLISHED)
->andWhere('fp.object_status_id <> :deleted')
->setParameter('deleted', CoRefObjectStatus::DELETE)
->andWhere('fp.publishing_status_id = :published')
->setParameter('published', CoRefPublishingStatus::PUBLISHED)
->add('orderBy', 'fl.listing_date DESC, fl.published_date DESC')
->setMaxResults($onTheMarketLimit);

    $onTheMarket = new Paginator($qb, $fetchJoin = true);

To make it work, I've renamed the second usage of the named variable with a 2 at the end. deleted2 and published2.

Originally created by @doctrinebot on GitHub (Apr 30, 2012). Originally assigned to: @Ocramius on GitHub. Jira issue originally created by user mdrolet: I use a dql query where I bind a named parameter 2 time in the same query for different joined fields. The query work but the count query failed saying that there are missing bind variable. ex: $qb = $this->getQueryBuilder() ->select(' partial fl.{id, title, listing_date, abstract}, partial fla.{id}, partial ca.{id}, partial ds.{id} ') ->from('Fo_Listing', 'fl') ->join('fl.listing_properties', 'flp') ->join('flp.property', 'fp') ->leftjoin('fl.listing_assets', 'fla') ->leftjoin('fla.asset', 'ca') ->leftjoin('ca.ds', 'ds') ->where('fp.id = :propertyId') ->setParameter('propertyId', $id) ->andWhere('fl.object_status_id <> :deleted') ->setParameter('deleted', CoRefObjectStatus::DELETE) ->andWhere('fl.publishing_status_id = :published') ->setParameter('published', CoRefPublishingStatus::PUBLISHED) ->andWhere('fp.object_status_id <> :deleted') ->setParameter('deleted', CoRefObjectStatus::DELETE) ->andWhere('fp.publishing_status_id = :published') ->setParameter('published', CoRefPublishingStatus::PUBLISHED) ->add('orderBy', 'fl.listing_date DESC, fl.published_date DESC') ->setMaxResults($onTheMarketLimit); ``` $onTheMarket = new Paginator($qb, $fetchJoin = true); ``` To make it work, I've renamed the second usage of the named variable with a 2 at the end. deleted2 and published2.
admin added the BugIncomplete labels 2026-01-22 13:46:49 +01:00
admin closed this issue 2026-01-22 13:46:50 +01:00
Author
Owner

@doctrinebot commented on GitHub (Jan 23, 2013):

Comment created by @ocramius:

This seems to be quite old. [~mdrolet] is it still valid with the latest ORM?

@doctrinebot commented on GitHub (Jan 23, 2013): Comment created by @ocramius: This seems to be quite old. [~mdrolet] is it still valid with the latest ORM?
Author
Owner

@doctrinebot commented on GitHub (Jan 25, 2013):

Comment created by mdrolet:

I'll try to test this problem on an updated version and I'll let you know.
The bug entry is also quite old and I've a local modified version of the paginator here to make it work with oracle, so it can take some time before I can test this out on the current doctrine version.

@doctrinebot commented on GitHub (Jan 25, 2013): Comment created by mdrolet: I'll try to test this problem on an updated version and I'll let you know. The bug entry is also quite old and I've a local modified version of the paginator here to make it work with oracle, so it can take some time before I can test this out on the current doctrine version.
Author
Owner

@doctrinebot commented on GitHub (Jan 25, 2013):

Comment created by @ocramius:

Ok, marking as awaiting feedback

@doctrinebot commented on GitHub (Jan 25, 2013): Comment created by @ocramius: Ok, marking as awaiting feedback
Author
Owner

@malukenho commented on GitHub (Jan 5, 2017):

@Ocramius It've been ~3 years of waiting. can be closed?

@malukenho commented on GitHub (Jan 5, 2017): @Ocramius It've been ~3 years of waiting. can be closed?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#2268