Doctrine PHPCR
  1. Doctrine PHPCR
  2. PHPCR-70

ContentDocument Relationships returning NULL in Action

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Labels:
      None

      Description

      So i have 2 Documents:

      Page: http://pastebin.com/b5X32JPc

      Category: http://pastebin.com/A1gB6kyg

      A Category has many pages.

      Now here's my (test) action: http://pastebin.com/ypjxqZPu

      As you can see, $contentDocument is a page in this case. If i call $contentDocument->category i get back "null".

      If however i tell the document manager to fetch the Page document by it's path, then $contentDocument->category will work...

      Our conclusion is that if you take the $contentDocument that is passed to your action, and you try to fetch it's ParentDocument inside the action (mapped to a property) you always get null.
      However, what is very weird, is that inside twig it works (page.category would work in twig but page->category would return null inside the action, before the twig render)

        Activity

        Hide
        David Buchmann added a comment -

        this might be a bug of combining reference with parent.

        [23:06] <dbu> look at vendor/doctrine/phpcr-odm/tests/Doctrine/Tests/ODM/PHPCR/Functional/HierarchyTest.php
        [23:07] <dbu> and create a new test that tries to load node C, follow its reference to node B and check if its parent A is not null

        Show
        David Buchmann added a comment - this might be a bug of combining reference with parent. [23:06] <dbu> look at vendor/doctrine/phpcr-odm/tests/Doctrine/Tests/ODM/PHPCR/Functional/HierarchyTest.php [23:07] <dbu> and create a new test that tries to load node C, follow its reference to node B and check if its parent A is not null
        Hide
        Lukas Kahwe added a comment -

        i have managed to reproduce the bug .. i am looking into fixing it now.

        Show
        Lukas Kahwe added a comment - i have managed to reproduce the bug .. i am looking into fixing it now.
        Hide
        Lukas Kahwe added a comment -

        fixed in master

        Show
        Lukas Kahwe added a comment - fixed in master

          People

          • Assignee:
            Lukas Kahwe
            Reporter:
            Freddy H.
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: