Doctrine 1
  1. Doctrine 1
  2. DC-715

Doctrine_Tree_NestedSet::fetchRoots does not return roots with no branches.

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.2.2, 1.2.3
    • Fix Version/s: 1.2.3
    • Component/s: Behaviors, Nested Set
    • Labels:
      None
    • Environment:
      any

      Description

      Doctrine_Tree_NestedSet::fetchRoots does not return roots with no branches.

        Activity

        Hide
        Jonathan H. Wage added a comment -

        This patch breaks our test suite:

        Doctrine_PessimisticLocking_TestCase............................................passed
        Doctrine_NestedSet_SingleRoot_TestCase..........................................failed
        
        
        Unexpected Doctrine_Query_Exception thrown in [Doctrine_NestedSet_SingleRoot_TestCase] with message [Unknown column ] in /Users/jwage/Sites/doctrine12/lib/Doctrine/Query.php on line 729
        
        Trace
        -------------
        
        #0 /Users/jwage/Sites/doctrine12/lib/Doctrine/Query/Where.php(93): Doctrine_Query->parseClause('base.')
        #1 /Users/jwage/Sites/doctrine12/lib/Doctrine/Query/Where.php(81): Doctrine_Query_Where->_buildSql('base.', 'IS', 'NULL')
        #2 /Users/jwage/Sites/doctrine12/lib/Doctrine/Query/Condition.php(92): Doctrine_Query_Where->load('base. IS NULL')
        #3 /Users/jwage/Sites/doctrine12/lib/Doctrine/Query/Abstract.php(2077): Doctrine_Query_Condition->parse('base. IS NULL')
        #4 /Users/jwage/Sites/doctrine12/lib/Doctrine/Query.php(1160): Doctrine_Query_Abstract->_processDqlQueryPart('where', Array)
        #5 /Users/jwage/Sites/doctrine12/lib/Doctrine/Query.php(1126): Doctrine_Query->buildSqlQuery(true)
        #6 /Users/jwage/Sites/doctrine12/lib/Doctrine/Query/Abstract.php(945): Doctrine_Query->getSqlQuery(Array)
        #7 /Users/jwage/Sites/doctrine12/lib/Doctrine/Query/Abstract.php(1026): Doctrine_Query_Abstract->_execute(Array)
        #8 /Users/jwage/Sites/doctrine12/lib/Doctrine/Tree/NestedSet.php(132): Doctrine_Query_Abstract->execute()
        #9 /Users/jwage/Sites/doctrine12/tests/NestedSet/SingleRootTestCase.php(60): Doctrine_Tree_NestedSet->fetchRoot()
        #10 /Users/jwage/Sites/doctrine12/tests/DoctrineTest/UnitTestCase.php(158): Doctrine_NestedSet_SingleRoot_TestCase->testLftRgtValues()
        #11 /Users/jwage/Sites/doctrine12/tests/DoctrineTest/GroupTest.php(75): UnitTestCase->run()
        #12 /Users/jwage/Sites/doctrine12/tests/DoctrineTest.php(183): GroupTest->run(Object(DoctrineTest_Reporter_Cli), '')
        #13 /Users/jwage/Sites/doctrine12/tests/run.php(320): DoctrineTest->run()
        #14 {main}
        
        
        
        Fatal error: Call to a member function getNode() on a non-object in /Users/jwage/Sites/doctrine12/tests/NestedSet/MultiRootTestCase.php on line 151
        
        Call Stack:
            0.0047     521504   1. {main}() /Users/jwage/Sites/doctrine12/tests/run.php:0
            0.7401   50855368   2. DoctrineTest->run() /Users/jwage/Sites/doctrine12/tests/run.php:320
            0.7410   50872656   3. GroupTest->run() /Users/jwage/Sites/doctrine12/tests/DoctrineTest.php:183
           55.2363  158425064   4. UnitTestCase->run() /Users/jwage/Sites/doctrine12/tests/DoctrineTest/GroupTest.php:75
           55.3227  158747088   5. Doctrine_NestedSet_MultiRoot_TestCase->testSaveMultipleRootsWithChildren() /Users/jwage/Sites/doctrine12/tests/DoctrineTest/UnitTestCase.php:158
        
        
        
        Show
        Jonathan H. Wage added a comment - This patch breaks our test suite: Doctrine_PessimisticLocking_TestCase............................................passed Doctrine_NestedSet_SingleRoot_TestCase..........................................failed Unexpected Doctrine_Query_Exception thrown in [Doctrine_NestedSet_SingleRoot_TestCase] with message [Unknown column ] in /Users/jwage/Sites/doctrine12/lib/Doctrine/Query.php on line 729 Trace ------------- #0 /Users/jwage/Sites/doctrine12/lib/Doctrine/Query/Where.php(93): Doctrine_Query->parseClause('base.') #1 /Users/jwage/Sites/doctrine12/lib/Doctrine/Query/Where.php(81): Doctrine_Query_Where->_buildSql('base.', 'IS', 'NULL') #2 /Users/jwage/Sites/doctrine12/lib/Doctrine/Query/Condition.php(92): Doctrine_Query_Where->load('base. IS NULL') #3 /Users/jwage/Sites/doctrine12/lib/Doctrine/Query/Abstract.php(2077): Doctrine_Query_Condition->parse('base. IS NULL') #4 /Users/jwage/Sites/doctrine12/lib/Doctrine/Query.php(1160): Doctrine_Query_Abstract->_processDqlQueryPart('where', Array) #5 /Users/jwage/Sites/doctrine12/lib/Doctrine/Query.php(1126): Doctrine_Query->buildSqlQuery( true ) #6 /Users/jwage/Sites/doctrine12/lib/Doctrine/Query/Abstract.php(945): Doctrine_Query->getSqlQuery(Array) #7 /Users/jwage/Sites/doctrine12/lib/Doctrine/Query/Abstract.php(1026): Doctrine_Query_Abstract->_execute(Array) #8 /Users/jwage/Sites/doctrine12/lib/Doctrine/Tree/NestedSet.php(132): Doctrine_Query_Abstract->execute() #9 /Users/jwage/Sites/doctrine12/tests/NestedSet/SingleRootTestCase.php(60): Doctrine_Tree_NestedSet->fetchRoot() #10 /Users/jwage/Sites/doctrine12/tests/DoctrineTest/UnitTestCase.php(158): Doctrine_NestedSet_SingleRoot_TestCase->testLftRgtValues() #11 /Users/jwage/Sites/doctrine12/tests/DoctrineTest/GroupTest.php(75): UnitTestCase->run() #12 /Users/jwage/Sites/doctrine12/tests/DoctrineTest.php(183): GroupTest->run( Object (DoctrineTest_Reporter_Cli), '') #13 /Users/jwage/Sites/doctrine12/tests/run.php(320): DoctrineTest->run() #14 {main} Fatal error: Call to a member function getNode() on a non-object in /Users/jwage/Sites/doctrine12/tests/NestedSet/MultiRootTestCase.php on line 151 Call Stack: 0.0047 521504 1. {main}() /Users/jwage/Sites/doctrine12/tests/run.php:0 0.7401 50855368 2. DoctrineTest->run() /Users/jwage/Sites/doctrine12/tests/run.php:320 0.7410 50872656 3. GroupTest->run() /Users/jwage/Sites/doctrine12/tests/DoctrineTest.php:183 55.2363 158425064 4. UnitTestCase->run() /Users/jwage/Sites/doctrine12/tests/DoctrineTest/GroupTest.php:75 55.3227 158747088 5. Doctrine_NestedSet_MultiRoot_TestCase->testSaveMultipleRootsWithChildren() /Users/jwage/Sites/doctrine12/tests/DoctrineTest/UnitTestCase.php:158
        Hide
        Jacek Krysztofik added a comment -

        Works for me (doctrine1-git):
        [code]
        ...
        Doctrine_NestedSet_SingleRoot_TestCase..........................................passed
        Doctrine_NestedSet_MultiRoot_TestCase...........................................passed
        Doctrine_NestedSet_TimestampableMultiRoot_TestCase..............................passed
        Doctrine_NestedSet_Hydration_TestCase...........................................passed

        Tested: 440 test cases.
        Successes: 0 passes.
        Failures: 0 fails.
        Number of new Failures: 0
        Number of fixed Failures: 0
        [/code]

        Show
        Jacek Krysztofik added a comment - Works for me (doctrine1-git): [code] ... Doctrine_NestedSet_SingleRoot_TestCase..........................................passed Doctrine_NestedSet_MultiRoot_TestCase...........................................passed Doctrine_NestedSet_TimestampableMultiRoot_TestCase..............................passed Doctrine_NestedSet_Hydration_TestCase...........................................passed Tested: 440 test cases. Successes: 0 passes. Failures: 0 fails. Number of new Failures: 0 Number of fixed Failures: 0 [/code]
        Hide
        Jonathan H. Wage added a comment -

        I apply your patch cleanly to a fresh checkout from SVN and it fails for me. I tried on my laptop and the CI server. Hmm

        Show
        Jonathan H. Wage added a comment - I apply your patch cleanly to a fresh checkout from SVN and it fails for me. I tried on my laptop and the CI server. Hmm
        Hide
        Jacek Krysztofik added a comment -

        Your failure log shows

        #3 /Users/jwage/Sites/doctrine12/lib/Doctrine/Query/Abstract.php(2077): Doctrine_Query_Condition->parse('base. IS NULL')

        which means the $this->getAttribute('rootColumnName') returns nothing. I think the problem is not in the patch but I cannot reproduce it, so I can't help.

        Show
        Jacek Krysztofik added a comment - Your failure log shows #3 /Users/jwage/Sites/doctrine12/lib/Doctrine/Query/Abstract.php(2077): Doctrine_Query_Condition->parse('base. IS NULL') which means the $this->getAttribute('rootColumnName') returns nothing. I think the problem is not in the patch but I cannot reproduce it, so I can't help.
        Hide
        Jonathan H. Wage added a comment -

        rootColumnName can be empty in some cases, no? when you don't have multiple roots.

        Show
        Jonathan H. Wage added a comment - rootColumnName can be empty in some cases, no? when you don't have multiple roots.

          People

          • Assignee:
            Jonathan H. Wage
            Reporter:
            Jacek Krysztofik
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: