Skip to content

Hydration broken when aliasing a column of a joined relation #134

@Phennim

Description

@Phennim

After this commit (1d68711) we get a different result for queries where we alias a column of a relation.

$rs = Doctrine_Query::create()
            ->select('c.id, h.hours as hrs')
            ->from('Calculation c')
            ->innerJoin('c.History h')
            ->execute([], Doctrine_Core::HYDRATE_ARRAY);

var_dump($rs);

/*
// After the commit we get:
array(1) {
    [0]=> array(2) {
        ["id"]=> string(5) "1"
        ["hrs"]=> string(4) "3.00"
    }
} 

// Before it was this (and therefore also the expected result):
array(1) {
     [0]=> array(3) {
         ["id"]=> string(5) "1"
         ["hrs"]=> string(4) "3.00"
         ["History"]=> array(2) {
             [0]=> array(2) {
                 ["id"]=> string(4) "1"
                 ["hrs"]=> string(4) "3.00"
             }
             [1]=> array(2) {
                 ["id"]=> string(3) "2"
                 ["hrs"]=> string(4) "2.00"
             }
         }
     }
} 
*/ 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions