Doctrine 1
  1. Doctrine 1
  2. DC-857

postHydrate not called for One to One relations, when ATTR_HYDRATE_OVERWRITE == false, and the record is cached in the table's identityMap

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Critical Critical
    • Resolution: Unresolved
    • Affects Version/s: 1.2.3
    • Fix Version/s: None
    • Component/s: Record
    • Labels:
      None
    • Environment:
      All

      Description

      When objects are hydrated with a join to a one to one relation, if the queried object is stored in the table's cache, and ATTR_HYDRATE_OVERWRITE set to false, then the one to one relation's postHydrate method will never be called.

      This is due to this line.

       
      } else if ( ! isset($prev[$parent][$relationAlias])) {
      

      ...which will always evaluate to false, and postHydrate will ever be called, as the record has been pulled from the table cache here

      1. DC857.patch
        1 kB
        Ben Davies
      2. DC857TestCase.php
        2 kB
        Ben Davies

        Activity

        Ben Davies created issue -
        Ben Davies made changes -
        Field Original Value New Value
        Attachment DC857TestCase.php [ 10770 ]
        Ben Davies made changes -
        Description When objects are hydrated with a join to a one to one relation, if the queried object is stored in the table's cache, and ATTR_HYDRATE_OVERWRITE set to false, then the one to one relation's postHydrate method will never be called.

        This is due to [this line|http://github.com/doctrine/doctrine1/blob/master/lib/Doctrine/Hydrator/Graph.php#L255].

        {code}
        isset($prev[$parent][$relationAlias])
        {code}

        ...will always evaluate to true (and postHydrate will ever be called, as the record has been pulled from the table cache [here|http://github.com/doctrine/doctrine1/blob/master/lib/Doctrine/Table.php#L1845]
        When objects are hydrated with a join to a one to one relation, if the queried object is stored in the table's cache, and ATTR_HYDRATE_OVERWRITE set to false, then the one to one relation's postHydrate method will never be called.

        This is due to [this line|http://github.com/doctrine/doctrine1/blob/master/lib/Doctrine/Hydrator/Graph.php#L255].

        {code}
        isset($prev[$parent][$relationAlias])
        {code}

        ...which will always evaluate to true (and postHydrate will ever be called, as the record has been pulled from the table cache [here|http://github.com/doctrine/doctrine1/blob/master/lib/Doctrine/Table.php#L1845]
        Ben Davies made changes -
        Description When objects are hydrated with a join to a one to one relation, if the queried object is stored in the table's cache, and ATTR_HYDRATE_OVERWRITE set to false, then the one to one relation's postHydrate method will never be called.

        This is due to [this line|http://github.com/doctrine/doctrine1/blob/master/lib/Doctrine/Hydrator/Graph.php#L255].

        {code}
        isset($prev[$parent][$relationAlias])
        {code}

        ...which will always evaluate to true (and postHydrate will ever be called, as the record has been pulled from the table cache [here|http://github.com/doctrine/doctrine1/blob/master/lib/Doctrine/Table.php#L1845]
        When objects are hydrated with a join to a one to one relation, if the queried object is stored in the table's cache, and ATTR_HYDRATE_OVERWRITE set to false, then the one to one relation's postHydrate method will never be called.

        This is due to [this line|http://github.com/doctrine/doctrine1/blob/master/lib/Doctrine/Hydrator/Graph.php#L255].

        {code}
        } else if ( ! isset($prev[$parent][$relationAlias])) {
        {code}

        ...which will always evaluate to true (and postHydrate will ever be called, as the record has been pulled from the table cache [here|http://github.com/doctrine/doctrine1/blob/master/lib/Doctrine/Table.php#L1845]
        Ben Davies made changes -
        Description When objects are hydrated with a join to a one to one relation, if the queried object is stored in the table's cache, and ATTR_HYDRATE_OVERWRITE set to false, then the one to one relation's postHydrate method will never be called.

        This is due to [this line|http://github.com/doctrine/doctrine1/blob/master/lib/Doctrine/Hydrator/Graph.php#L255].

        {code}
        } else if ( ! isset($prev[$parent][$relationAlias])) {
        {code}

        ...which will always evaluate to true (and postHydrate will ever be called, as the record has been pulled from the table cache [here|http://github.com/doctrine/doctrine1/blob/master/lib/Doctrine/Table.php#L1845]
        When objects are hydrated with a join to a one to one relation, if the queried object is stored in the table's cache, and ATTR_HYDRATE_OVERWRITE set to false, then the one to one relation's postHydrate method will never be called.

        This is due to [this line|http://github.com/doctrine/doctrine1/blob/master/lib/Doctrine/Hydrator/Graph.php#L255].

        {code}
        } else if ( ! isset($prev[$parent][$relationAlias])) {
        {code}

        ...which will always evaluate to true (and postHydrate will ever be called, as the record has been pulled from the table cache [here|http://github.com/doctrine/doctrine1/blob/master/lib/Doctrine/Hydrator/Graph.php#L155]
        Ben Davies made changes -
        Attachment DC857TestCase.php [ 10771 ]
        Ben Davies made changes -
        Comment [ Ignore number 2 attachment. Number 1 is the right one.
        http://www.doctrine-project.org/jira/secure/attachment/10771/DC857TestCase.php ]
        Ben Davies made changes -
        Attachment DC857TestCase_Correct.php [ 10772 ]
        Ben Davies made changes -
        Attachment DC857TestCase.php [ 10771 ]
        Ben Davies made changes -
        Attachment DC857TestCase.php [ 10770 ]
        Ben Davies made changes -
        Attachment DC857TestCase_Correct.php [ 10772 ]
        Ben Davies made changes -
        Attachment DC857TestCase.php [ 10773 ]
        Ben Davies made changes -
        Description When objects are hydrated with a join to a one to one relation, if the queried object is stored in the table's cache, and ATTR_HYDRATE_OVERWRITE set to false, then the one to one relation's postHydrate method will never be called.

        This is due to [this line|http://github.com/doctrine/doctrine1/blob/master/lib/Doctrine/Hydrator/Graph.php#L255].

        {code}
        } else if ( ! isset($prev[$parent][$relationAlias])) {
        {code}

        ...which will always evaluate to true (and postHydrate will ever be called, as the record has been pulled from the table cache [here|http://github.com/doctrine/doctrine1/blob/master/lib/Doctrine/Hydrator/Graph.php#L155]
        When objects are hydrated with a join to a one to one relation, if the queried object is stored in the table's cache, and ATTR_HYDRATE_OVERWRITE set to false, then the one to one relation's postHydrate method will never be called.

        This is due to [this line|http://github.com/doctrine/doctrine1/blob/master/lib/Doctrine/Hydrator/Graph.php#L255].

        {code}
        } else if ( ! isset($prev[$parent][$relationAlias])) {
        {code}

        ...which will always evaluate to false, and postHydrate will ever be called, as the record has been pulled from the table cache [here|http://github.com/doctrine/doctrine1/blob/master/lib/Doctrine/Hydrator/Graph.php#L155]
        Ben Davies made changes -
        Attachment DC857.patch [ 10774 ]

          People

          • Assignee:
            Jonathan H. Wage
            Reporter:
            Ben Davies
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated: