mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
Getting parent of null #5661
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @mcanepa on GitHub (Aug 29, 2017).
Originally assigned to: @Ocramius on GitHub.
I have an entity "MyEntity" like
With this attribute that serves as reference to the parent
In the database, data like this is stored
My problem was that when getting a collection for the first level under root level I got this message:
This occured becasuse when Doctrine trid to fetch the parent of 1, wich is null, then the
getEntity()method inObjectHydrator.phpfailed.I solved the issue doing the following just above
if(!is_null($data)) continue;@Ocramius commented on GitHub (Aug 29, 2017):
Can you please make a minimum reproducible test case? This is a base
scenario, so this smells a lot...
On 29 Aug 2017 17:33, "Matías Cánepa" notifications@github.com wrote:
@mcanepa commented on GitHub (Sep 19, 2017):
@Ocramius It took me a while to reproduce the case in a separate code. But now that I did I'm not sure if I'm doing something wrong or is actually a bug.
May be it is not doctrine at all, but how API Platorm leverage on the ORM.
I opened an issue on their side
@Ocramius commented on GitHub (Sep 19, 2017):
@mcanepa that's precisely the point of a test case. Can you maybe submit a PR with just the test, so it can be discussed on code, even of it ends up being invalid?
@benjaminrau commented on GitHub (Sep 26, 2018):
Just to keep this up to date because i landed here searching for this issue. The bug was part of Api Platform and was solved in version 2.2: https://github.com/api-platform/core/issues/1959
@Ocramius commented on GitHub (Sep 26, 2018):
Closing here then.