Bug #27170

countByProperty does not work

Added by Christopher Hlubek about 4 years ago. Updated about 4 years ago.

Status:Resolved Start date:2011-05-31
Priority:Must have Due date:
Assigned To:- % Done:

100%

Category:Persistence
Target version:-
PHP Version: Complexity:
Has patch: Affected Flow version:

Description

A magic count method with property (e.g. countByName) does not work with the current Doctrine implementation of count() in F3\FLOW3\Persistence\Doctrine\Query:

 1public function count() {
 2    try {
 3        $dqlQuery = clone $this->queryBuilder->getQuery();
 4        $dqlQuery->setHint(\Doctrine\ORM\Query::HINT_CUSTOM_TREE_WALKERS, array('F3\FLOW3\Persistence\Doctrine\CountWalker'));
 5        return (int)$dqlQuery->getSingleScalarResult();
 6    } catch (\Doctrine\ORM\ORMException $e) {
 7        return 0;
 8    }
 9}

The problem seems to be the clone of the query which results in an empty parameter array when executing the cloned query.

Associated revisions

Revision ce5f26c6
Added by Christopher Hlubek about 4 years ago

[BUGFIX] Persistence: Fix count queries with parameters

Change-Id: Ia6b5f594012963cf54b542a62892da789832a97c
Resolves: #27170

History

#1 Updated by Mr. Hudson about 4 years ago

Patch set 1 of change Ia6b5f594012963cf54b542a62892da789832a97c has been pushed to the review server.
It is available at http://review.typo3.org/2468

#2 Updated by Christopher Hlubek about 4 years ago

  • Status changed from New to Resolved
  • % Done changed from 0 to 100

Also available in: Atom PDF