Bug #27170

countByProperty does not work

Added by Christopher Hlubek over 10 years ago. Updated over 10 years ago.

Status:
Resolved
Priority:
Must have
Assignee:
-
Category:
Persistence
Target version:
-
Start date:
2011-05-31
Due date:
% Done:

100%

Estimated time:
PHP Version:
Has patch:
Complexity:

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:

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

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

#1

Updated by Mr. Hudson over 10 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 over 10 years ago

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

Also available in: Atom PDF