[PR #677] [CLOSED] Type fix in ORM\PersistentCollection #8538

Open
opened 2026-01-22 16:00:23 +01:00 by admin · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/doctrine/orm/pull/677
Author: @michaldudek
Created: 5/27/2013
Status: Closed

Base: masterHead: master


📝 Commits (1)

  • 188ddc3 Type fix in ORM\PersistentCollection.

📊 Changes

1 file changed (+1 additions, -1 deletions)

View changed files

📝 lib/Doctrine/ORM/PersistentCollection.php (+1 -1)

📄 Description

The ORM\PersistentCollection class accepts anything as 3rd argument to its constructor while it should be either array or Collection object. The $this->coll phpdoc says that it's a Collection while the constructor's phpdoc says it's an array.

The class assumes Collection but there isn't any type check at all. I have added conversion of array into ArrayCollection in the constructor as in some (very unclear) cases it likes to die with a fatal error:

Fatal error: Call to a member function add() on a non-object in Doctrine/ORM/PersistentCollection.php on line 169


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/doctrine/orm/pull/677 **Author:** [@michaldudek](https://github.com/michaldudek) **Created:** 5/27/2013 **Status:** ❌ Closed **Base:** `master` ← **Head:** `master` --- ### 📝 Commits (1) - [`188ddc3`](https://github.com/doctrine/orm/commit/188ddc342ec51b8059322d90937a479c71e9411f) Type fix in ORM\PersistentCollection. ### 📊 Changes **1 file changed** (+1 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `lib/Doctrine/ORM/PersistentCollection.php` (+1 -1) </details> ### 📄 Description The `ORM\PersistentCollection` class accepts anything as 3rd argument to its constructor while it should be either array or `Collection` object. The `$this->coll` phpdoc says that it's a `Collection` while the constructor's phpdoc says it's an array. The class assumes `Collection` but there isn't any type check at all. I have added conversion of array into `ArrayCollection` in the constructor as in some (very unclear) cases it likes to die with a fatal error: `Fatal error: Call to a member function add() on a non-object in Doctrine/ORM/PersistentCollection.php on line 169` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
admin added the pull-request label 2026-01-22 16:00:23 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#8538