DDC-1875: "Call to a member function toArray() on a non-object" in PersistentCollection::takeSnapshot() during LEFT JOIN #2367

Closed
opened 2026-01-22 13:50:24 +01:00 by admin · 5 comments
Owner

Originally created by @doctrinebot on GitHub (Jun 15, 2012).

Originally assigned to: @beberlei on GitHub.

Jira issue originally created by user jschreuder:

I am getting the fatal error "Call to a member function toArray() on a non-object" which is triggered in Doctrine/ORM/PersistentCollection.php on line 239 by $this->snapshot = $this->coll->toArray();

SELECT i, c FROM Page i
LEFT JOIN i.children c
WHERE i.parent_id IS NULL
    AND i.site = ?1
ORDER BY i.id ASC

The association is self-referential on the column parent_id. Removing "LEFT" from the query makes is run successfully (but ofc not in the way I need it). Making it only select 'i' instead of 'i, c' also solves it. But I don't think it's wrong in it's current form is it?

The Entity (slightly truncated to remove personal/local info) is at http://scrp.at/bvl

Originally created by @doctrinebot on GitHub (Jun 15, 2012). Originally assigned to: @beberlei on GitHub. Jira issue originally created by user jschreuder: I am getting the fatal error "Call to a member function toArray() on a non-object" which is triggered in Doctrine/ORM/PersistentCollection.php on line 239 by $this->snapshot = $this->coll->toArray(); ``` SELECT i, c FROM Page i LEFT JOIN i.children c WHERE i.parent_id IS NULL AND i.site = ?1 ORDER BY i.id ASC ``` The association is self-referential on the column parent_id. Removing "LEFT" from the query makes is run successfully (but ofc not in the way I need it). Making it only select 'i' instead of 'i, c' also solves it. But I don't think it's wrong in it's current form is it? The Entity (slightly truncated to remove personal/local info) is at http://scrp.at/bvl
admin added the Bug label 2026-01-22 13:50:24 +01:00
admin closed this issue 2026-01-22 13:50:27 +01:00
Author
Owner

@doctrinebot commented on GitHub (Jul 5, 2012):

Comment created by @beberlei:

can you paste the full stack trace when the error occurs? Xdebug shows this.

@doctrinebot commented on GitHub (Jul 5, 2012): Comment created by @beberlei: can you paste the full stack trace when the error occurs? Xdebug shows this.
Author
Owner

@doctrinebot commented on GitHub (Oct 6, 2012):

Comment created by @beberlei:

No feedback given and cannot reproduce.

@doctrinebot commented on GitHub (Oct 6, 2012): Comment created by @beberlei: No feedback given and cannot reproduce.
Author
Owner

@doctrinebot commented on GitHub (Oct 6, 2012):

Issue was closed with resolution "Cannot Reproduce"

@doctrinebot commented on GitHub (Oct 6, 2012): Issue was closed with resolution "Cannot Reproduce"
Author
Owner

@doctrinebot commented on GitHub (Jun 21, 2014):

Comment created by kolomiets:

{quote}( ! ) Fatal error: Call to a member function toArray() on a non-object in /var/www/html/mktl/vendor/doctrine/orm/lib/Doctrine/ORM/PersistentCollection.php on line 245
Call Stack

Time Memory Function Location

1 0.0001 233752 {main}( ) ../index.php:0
2 0.0003 234472 require_once( '/var/www/html/mktl/public/app.php' ) ../index.php:17
3 0.0573 3065184 Zend\Mvc\Application->run( ) ../app.php:33
4 0.0590 3100288 Zend\EventManager\EventManager->trigger( ) ../Application.php:309
5 0.0590 3100336 Zend\EventManager\EventManager->triggerListeners( ) ../EventManager.php:207
6 0.0594 3108144 call_user_func:{/var/www/html/mktl/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php:468} ( ) ../EventManager.php:468
7 0.0594 3108712 Zend\Mvc\DispatchListener->onDispatch( ) ../EventManager.php:468
8 0.0600 3169304 Zend\Mvc\Controller\AbstractController->dispatch( ) ../DispatchListener.php:114
9 0.0600 3169784 Zend\EventManager\EventManager->trigger( ) ../AbstractController.php:117
10 0.0600 3169832 Zend\EventManager\EventManager->triggerListeners( ) ../EventManager.php:207
11 0.0604 3185720 call_user_func:{/var/www/html/mktl/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php:468} ( ) ../EventManager.php:468
12 0.0604 3186312 Admin\AController->onDispatch( ) ../EventManager.php:468
13 0.0746 4270960 Zend\Mvc\Controller\AbstractActionController->onDispatch( ) ../AController.php:159
14 0.0747 4271224 Admin\Controller\BrandsController->editAction( ) ../AbstractActionController.php:83
15 0.0751 4313696 Products\Repositories\BrandRepository->find( ) ../BrandsController.php:70
16 0.0761 4451448 Doctrine\ORM\AbstractQuery->getResult( ) ../BrandRepository.php:60
17 0.0761 4451808 Doctrine\ORM\AbstractQuery->execute( ) ../AbstractQuery.php:542
18 0.0768 4473080 Doctrine\ORM\Internal\Hydration\AbstractHydrator->hydrateAll( ) ../AbstractQuery.php:751
19 0.0769 4477328 Doctrine\ORM\Internal\Hydration\ObjectHydrator->hydrateAllData( ) ../AbstractHydrator.php:111
20 0.0781 4673184 Doctrine\ORM\PersistentCollection->takeSnapshot( ) ../ObjectHydrator.php:155
{quote}

@doctrinebot commented on GitHub (Jun 21, 2014): Comment created by kolomiets: {quote}( ! ) Fatal error: Call to a member function toArray() on a non-object in /var/www/html/mktl/vendor/doctrine/orm/lib/Doctrine/ORM/PersistentCollection.php on line 245 Call Stack # Time Memory Function Location 1 0.0001 233752 {main}( ) ../index.php:0 2 0.0003 234472 require_once( '/var/www/html/mktl/public/app.php' ) ../index.php:17 3 0.0573 3065184 Zend\Mvc\Application->run( ) ../app.php:33 4 0.0590 3100288 Zend\EventManager\EventManager->trigger( ) ../Application.php:309 5 0.0590 3100336 Zend\EventManager\EventManager->triggerListeners( ) ../EventManager.php:207 6 0.0594 3108144 call_user_func:{/var/www/html/mktl/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php:468} ( ) ../EventManager.php:468 7 0.0594 3108712 Zend\Mvc\DispatchListener->onDispatch( ) ../EventManager.php:468 8 0.0600 3169304 Zend\Mvc\Controller\AbstractController->dispatch( ) ../DispatchListener.php:114 9 0.0600 3169784 Zend\EventManager\EventManager->trigger( ) ../AbstractController.php:117 10 0.0600 3169832 Zend\EventManager\EventManager->triggerListeners( ) ../EventManager.php:207 11 0.0604 3185720 call_user_func:{/var/www/html/mktl/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php:468} ( ) ../EventManager.php:468 12 0.0604 3186312 Admin\AController->onDispatch( ) ../EventManager.php:468 13 0.0746 4270960 Zend\Mvc\Controller\AbstractActionController->onDispatch( ) ../AController.php:159 14 0.0747 4271224 Admin\Controller\BrandsController->editAction( ) ../AbstractActionController.php:83 15 0.0751 4313696 Products\Repositories\BrandRepository->find( ) ../BrandsController.php:70 16 0.0761 4451448 Doctrine\ORM\AbstractQuery->getResult( ) ../BrandRepository.php:60 17 0.0761 4451808 Doctrine\ORM\AbstractQuery->execute( ) ../AbstractQuery.php:542 18 0.0768 4473080 Doctrine\ORM\Internal\Hydration\AbstractHydrator->hydrateAll( ) ../AbstractQuery.php:751 19 0.0769 4477328 Doctrine\ORM\Internal\Hydration\ObjectHydrator->hydrateAllData( ) ../AbstractHydrator.php:111 20 0.0781 4673184 Doctrine\ORM\PersistentCollection->takeSnapshot( ) ../ObjectHydrator.php:155 {quote}
Author
Owner

@doctrinebot commented on GitHub (Jun 22, 2014):

Comment created by @ocramius:

Are the mappings passing validation?

@doctrinebot commented on GitHub (Jun 22, 2014): Comment created by @ocramius: Are the mappings passing validation?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#2367