dimanche 26 juin 2016

Getting row count after matching query call

I am trying to get the row count from a query, using doctrine and repository pattern.

This is the code I have:

$criteria = new \Doctrine\Common\Collections\Criteria();
        $criteria
        ->andWhere($criteria->expr()->eq('referrer', $referrer))
        ->andWhere($criteria->expr()->gte('date_creation', $date));

        return $this->em->getRepository($this->class)->matching(
    $criteria,
    array('id' => 'ASC')
    );

How can I get the number of matching rows from the returned object?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire