Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-317

Using a function only in hydration returns only one result

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 2.0-ALPHA4
    • Fix Version/s: 2.0-BETA1
    • Component/s: ORM
    • Security Level: All
    • Labels:
      None

      Description

      Output of $arg:

      array(1) {
        [-1]=>
        array(1) {
          ["namedep"]=>
          string(25) "Jonathan W.Administration"
        }
      }
      
          public function testConcatFunction()
          {
              $this->generateFixture();
              $arg = $this->_em->createQuery('SELECT CONCAT(m.name, m.department) AS namedep FROM Doctrine\Tests\Models\Company\CompanyManager m')
                               ->getArrayResult();
      
              $this->assertEquals(4, count($arg)); // fails with 1
          }
      
          protected function generateFixture()
          {
              $manager1 = new CompanyManager();
              $manager1->setName('Roman B.');
              $manager1->setTitle('');
              $manager1->setDepartment('IT');
              $manager1->setSalary(100000);
      
              $manager2 = new CompanyManager();
              $manager2->setName('Benjamin E.');
              $manager2->setTitle('');
              $manager2->setDepartment('HR');
              $manager2->setSalary(200000);
      
              $manager3 = new CompanyManager();
              $manager3->setName('Guilherme B.');
              $manager3->setTitle('');
              $manager3->setDepartment('Complaint Department');
              $manager3->setSalary(400000);
      
              $manager4 = new CompanyManager();
              $manager4->setName('Jonathan W.');
              $manager4->setTitle('');
              $manager4->setDepartment('Administration');
              $manager4->setSalary(800000);
      
              $this->_em->persist($manager1);
              $this->_em->persist($manager2);
              $this->_em->persist($manager3);
              $this->_em->persist($manager4);
              $this->_em->flush();
              $this->_em->clear();
          }
      

        Activity

          People

          • Assignee:
            Roman S. Borschel
            Reporter:
            Benjamin Eberlei
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: