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

        Benjamin Eberlei created issue -
        Hide
        Benjamin Eberlei added a comment -

        Additional bug, changing the DQL to:

        SELECT CONCAT(m.name, m.department) AS namedep FROM Doctrine\Tests\Models\Company\CompanyManager m WHERE m.id = 4
        

        returns an empty result.

        Show
        Benjamin Eberlei added a comment - Additional bug, changing the DQL to: SELECT CONCAT(m.name, m.department) AS namedep FROM Doctrine\Tests\Models\Company\CompanyManager m WHERE m.id = 4 returns an empty result.
        Hide
        Benjamin Eberlei added a comment -

        Thie following DQL gives a partial error bug:

        SELECT m, m.salary+2500 AS add FROM Doctrine\Tests\Models\Company\CompanyManager m
        

        Error:

        Doctrine\Tests\ORM\Functional\QueryDqlFunctionTest::testOperatorAdd()
        Exception: [Doctrine\Common\DoctrineException] Loading partial objects is dangerous. Fetch full objects or consider using a different fetch mode. If you really want partial objects, set the doctrine.forcePartialLoad query hint to TRUE.
        
        Show
        Benjamin Eberlei added a comment - Thie following DQL gives a partial error bug: SELECT m, m.salary+2500 AS add FROM Doctrine\Tests\Models\Company\CompanyManager m Error: Doctrine\Tests\ORM\Functional\QueryDqlFunctionTest::testOperatorAdd() Exception: [Doctrine\Common\DoctrineException] Loading partial objects is dangerous. Fetch full objects or consider using a different fetch mode. If you really want partial objects, set the doctrine.forcePartialLoad query hint to TRUE.
        Hide
        Benjamin Eberlei added a comment -

        The same goes for - * and /

        Show
        Benjamin Eberlei added a comment - The same goes for - * and /
        Roman S. Borschel made changes -
        Field Original Value New Value
        Fix Version/s 2.0-BETA1 [ 10030 ]
        Roman S. Borschel made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        Hide
        Benjamin Eberlei added a comment -

        Generated SQL of the CONCAT Example:

        SELECT CONCAT(c0_.name, c1_.department) AS sclr0 FROM company_managers c2_ INNER JOIN company_employees c1_ ON c2_.id = c1_.id INNER JOIN company_persons c0_ ON c2_.id = c0_.id
        
        Show
        Benjamin Eberlei added a comment - Generated SQL of the CONCAT Example: SELECT CONCAT(c0_.name, c1_.department) AS sclr0 FROM company_managers c2_ INNER JOIN company_employees c1_ ON c2_.id = c1_.id INNER JOIN company_persons c0_ ON c2_.id = c0_.id
        Hide
        Roman S. Borschel added a comment -

        Should be fixed now.

        Show
        Roman S. Borschel added a comment - Should be fixed now.
        Roman S. Borschel made changes -
        Status In Progress [ 3 ] Closed [ 6 ]
        Resolution Fixed [ 1 ]
        Benjamin Eberlei made changes -
        Workflow jira [ 10868 ] jira-feedback [ 15545 ]
        Benjamin Eberlei made changes -
        Workflow jira-feedback [ 15545 ] jira-feedback2 [ 17409 ]
        Benjamin Eberlei made changes -
        Workflow jira-feedback2 [ 17409 ] jira-feedback3 [ 19666 ]

        This list may be incomplete, as errors occurred whilst retrieving source from linked applications:

        • Request to http://www.doctrine-project.org/fisheye/ failed: Error in remote call to 'FishEye 0 (http://www.doctrine-project.org/fisheye/)' (http://www.doctrine-project.org/fisheye) [AbstractRestCommand{path='/rest-service-fe/search-v1/crossRepositoryQuery', params={query=DDC-317, expand=changesets[0:20].revisions[0:29],reviews}, methodType=GET}] : Received status code 503 (Service Temporarily Unavailable)

          People

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

            Dates

            • Created:
              Updated:
              Resolved: