Пример #1
0
 public function getCount(Condition $condition = null)
 {
     $builder = $this->connection->createQueryBuilder()->select($this->connection->getDatabasePlatform()->getCountExpression($this->getPrimaryKey()))->from($this->getName(), null);
     if ($condition !== null && $condition->hasCondition()) {
         $builder->where(substr($condition->getStatment(), 5));
         $values = $condition->getValues();
         foreach ($values as $key => $value) {
             $builder->setParameter($key, $value);
         }
     }
     return (int) $this->connection->fetchColumn($builder->getSQL(), $builder->getParameters());
 }