Closed Lewiatan closed 3 years ago
@Lewiatan thank you for the bug report! The collection code is generated in ODM itself, if you'd want to take a stab at fixing the bug it's here: https://github.com/doctrine/mongodb-odm/blob/3bdfe97be472160ebbc924d5882ce61bd640a515/lib/Doctrine/ODM/MongoDB/PersistentCollection/DefaultPersistentCollectionGenerator.php#L204. The generated code template needs to have the return
part removed if void
is declared as a return type. You'd also need to add a test case, here's a good candidate to add it to: https://github.com/doctrine/mongodb-odm/blob/3bdfe97be472160ebbc924d5882ce61bd640a515/tests/Doctrine/ODM/MongoDB/Tests/Functional/CustomCollectionsTest.php.
Sure, I'll give it a try ;)
Bug Report
I have a collection that extends Doctrine\Common\Collections\ArrayCollection which is persisted to database. This collection has methods that returns void, for example:
The generated persistent collection is trying to return value from void method:
I updated symfony recently, and during that process doctrine/common was also updated. I think that with doctrine/common in version 2.12 it was working, but I'm not 100% sure if I had outdated cache. I can verify that if needed.
How to reproduce
Expected behavior
Void methods are supported by proxy classes