/**
  * @group DDC-407
  */
 public function testHydrateScalarResults()
 {
     $rsm = new ResultSetMapping();
     $rsm->addScalarResult('foo1', 'foo');
     $rsm->addScalarResult('bar2', 'bar');
     $rsm->addScalarResult('baz3', 'baz');
     $resultSet = array(array('foo1' => 'A', 'bar2' => 'B', 'baz3' => 'C'));
     $stmt = new HydratorMockStatement($resultSet);
     $hydrator = new \Doctrine\ORM\Internal\Hydration\ScalarHydrator($this->_em);
     $result = $hydrator->hydrateAll($stmt, $rsm);
 }
 /**
  * @group DDC-644
  */
 public function testSkipUnknownColumns()
 {
     $rsm = new ResultSetMapping();
     $rsm->addEntityResult('Doctrine\\Tests\\Models\\CMS\\CmsUser', 'u');
     $rsm->addFieldResult('u', 'u__id', 'id');
     $rsm->addFieldResult('u', 'u__name', 'name');
     $rsm->addScalarResult('foo1', 'foo');
     $rsm->addScalarResult('bar2', 'bar');
     $rsm->addScalarResult('baz3', 'baz');
     $resultSet = array(array('u__id' => '1', 'u__name' => 'romanb', 'foo1' => 'A', 'bar2' => 'B', 'baz3' => 'C', 'foo' => 'bar'));
     $stmt = new HydratorMockStatement($resultSet);
     $hydrator = new \Doctrine\ORM\Internal\Hydration\ScalarHydrator($this->_em);
     $result = $hydrator->hydrateAll($stmt, $rsm);
 }
 /**
  * Select u.id, u.name from CmsUser u
  */
 public function testNewHydrationSimpleEntityQuery()
 {
     $rsm = new ResultSetMapping();
     $rsm->addEntityResult('Doctrine\\Tests\\Models\\CMS\\CmsUser', 'u');
     $rsm->addFieldResult('u', 'u__id', 'id');
     $rsm->addFieldResult('u', 'u__name', 'name');
     // Faked result set
     $resultSet = array(array('u__id' => '1', 'u__name' => 'romanb'), array('u__id' => '2', 'u__name' => 'jwage'));
     $stmt = new HydratorMockStatement($resultSet);
     $hydrator = new \Doctrine\ORM\Internal\Hydration\ScalarHydrator($this->_em);
     $result = $hydrator->hydrateAll($stmt, $rsm);
     $this->assertTrue(is_array($result));
     $this->assertEquals(2, count($result));
     $this->assertEquals('romanb', $result[0]['u_name']);
     $this->assertEquals(1, $result[0]['u_id']);
     $this->assertEquals('jwage', $result[1]['u_name']);
     $this->assertEquals(2, $result[1]['u_id']);
 }
 /**
  * Times for comparison:
  *
  * [romanb: 10000 rows => 0.7 seconds]
  *
  * MAXIMUM TIME: 1 second
  */
 public function testSimpleQueryScalarHydrationPerformance10000Rows()
 {
     $rsm = new ResultSetMapping();
     $rsm->addEntityResult('Doctrine\\Tests\\Models\\CMS\\CmsUser', 'u');
     $rsm->addFieldResult('u', 'u__id', 'id');
     $rsm->addFieldResult('u', 'u__status', 'status');
     $rsm->addFieldResult('u', 'u__username', 'username');
     $rsm->addFieldResult('u', 'u__name', 'name');
     // Faked result set
     $resultSet = array(array('u__id' => '1', 'u__status' => 'developer', 'u__username' => 'romanb', 'u__name' => 'Roman'), array('u__id' => '1', 'u__status' => 'developer', 'u__username' => 'romanb', 'u__name' => 'Roman'), array('u__id' => '2', 'u__status' => 'developer', 'u__username' => 'romanb', 'u__name' => 'Roman'));
     for ($i = 4; $i < 10000; ++$i) {
         $resultSet[] = array('u__id' => $i, 'u__status' => 'developer', 'u__username' => 'jwage', 'u__name' => 'Jonathan');
     }
     $stmt = new HydratorMockStatement($resultSet);
     $hydrator = new \Doctrine\ORM\Internal\Hydration\ScalarHydrator($this->_em);
     $this->setMaxRunningTime(1);
     $s = microtime(true);
     $result = $hydrator->hydrateAll($stmt, $rsm);
     $e = microtime(true);
     echo __FUNCTION__ . " - " . ($e - $s) . " seconds" . PHP_EOL;
 }