コード例 #1
0
 public function testCountCondition()
 {
     $persister = new BasicEntityPersister($this->_em, $this->_em->getClassMetadata('Doctrine\\Tests\\ORM\\Functional\\Ticket\\DDC1719SimpleEntity'));
     // Using a criteria as array
     $statement = $persister->getCountSQL(array('value' => 'bar'));
     $this->assertEquals('SELECT COUNT(*) FROM "ddc-1719-simple-entity" t0 WHERE t0."simple-entity-value" = ?', $statement);
     // Using a criteria object
     $criteria = new Criteria(Criteria::expr()->eq('value', 'bar'));
     $statement = $persister->getCountSQL($criteria);
     $this->assertEquals('SELECT COUNT(*) FROM "ddc-1719-simple-entity" t0 WHERE t0."simple-entity-value" = ?', $statement);
 }