Uploaded image for project: 'Doctrine 2 - ORM'
  1. Doctrine 2 - ORM
  2. DDC-1410

leftJoin with condition WITH & Object Hydratation problem.

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: Git Master
    • Fix Version/s: 2.1.3
    • Component/s: DQL, ORM
    • Security Level: All
    • Labels:
      None
    • Environment:
      Debian 5 dotdeb
      PHP 5.3
      MySQL 5.0
      Apache 2.2

      Description

      Here an example of a simple QueryBuilder :

      $queryBuilder = $entityManager->createQueryBuilder();
      $queryBuilder->select ( "player, options" );
      $queryBuilder->from ( "Player_Model_Entity_Player", "player");
      $queryBuilder->where ("player.idPlayer = 12");
      $queryBuilder->leftJoin ("player.options", "options", "WITH", "options.enabled = :enabled");
      $queryBuilder->setParameter ("enabled", 1);

      OptionA & OptionB & OptionC three entities.
      User case :

      • OptionA.enabled = 1 & OptionB.enabled = 1 & OptionC.enabled = 1 : OK - All options are return.
      • OptionA.enabled = 1 & OptionB.enabled = 0 & OptionC.enabled = 0 : OK - only optionA is return.
      • OptionA.enabled = 1 & OptionB.enabled = 0 & OptionC.enabled = 1 : OK - only optionA & optionC is return.
      • OptionA.enabled = 0 & OptionB.enabled = 1 & OptionC.enabled = 1 : KO - no option return.
      • OptionA.enabled = 0 & OptionB.enabled = 0 & OptionC.enabled = 0 : OK - no option return.

      I have test on OneToMany configuration and I have not problem. The problem only appear with ManyToMany relationships.

      The problem seems to be on hydratation. The data return on SQL command seems to be correct.

        Activity

        armetiz Thomas Tourlourat - Armetiz created issue -
        armetiz Thomas Tourlourat - Armetiz made changes -
        Field Original Value New Value
        Attachment ObjectHydrator_DDC-1410_v1.patch [ 11078 ]
        armetiz Thomas Tourlourat - Armetiz made changes -
        Summary ManyToMany and leftJoin with condition ( WITH ) ManyToMany and leftJoin with condition ( WITH ). Object Hydratation problem.
        armetiz Thomas Tourlourat - Armetiz made changes -
        Summary ManyToMany and leftJoin with condition ( WITH ). Object Hydratation problem. leftJoin with condition WITH & Object Hydratation problem.
        beberlei Benjamin Eberlei made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 2.1.3 [ 10164 ]
        Resolution Fixed [ 1 ]
        beberlei Benjamin Eberlei made changes -
        Workflow jira [ 13075 ] jira-feedback [ 15052 ]
        beberlei Benjamin Eberlei made changes -
        Workflow jira-feedback [ 15052 ] jira-feedback2 [ 16916 ]
        beberlei Benjamin Eberlei made changes -
        Workflow jira-feedback2 [ 16916 ] jira-feedback3 [ 19169 ]

          People

          • Assignee:
            beberlei Benjamin Eberlei
            Reporter:
            armetiz Thomas Tourlourat - Armetiz
          • Votes:
            2 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: