mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
[ContextErrorException] doctrine generate entities with embedded fields #5016
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 @yceruto on GitHub (Feb 11, 2016).
Originally assigned to: @Majkl578 on GitHub.
I've an entity with one embedded field:
Running the command:
doctrine:generate:entities AppBundle:Box -vvvthrows an exception:I've changed this lines and work for me (source):
if they agree I can create a PR to fix this.
@Ocramius commented on GitHub (Feb 11, 2016):
The change seems wrong to me: an entity name is not necessarily its reflection class name in all cases. Wondering why the reflection wasn't initialized in that case, but it seems like the doctrine bundle is using a "cold" reflection service.
@yceruto commented on GitHub (Feb 11, 2016):
Exactly, in this case the reflection service class is
StaticReflectionService, then$this->reflClassisnull. What would be the right solution?@Ocramius commented on GitHub (Feb 11, 2016):
Wondering if populating the reflection with a fake reflection instance could work. This reflection service has bitten us many many times...
@yceruto commented on GitHub (Feb 11, 2016):
@Ocramius I've another issue related with the same command
doctrine:generate:entitieswhen exists more than one levels embedded, I found this commit with a solution but I don't see it in 2.5 or master branchs.
@Ocramius commented on GitHub (Feb 11, 2016):
That commit is in a fork, no?@Ocramius commented on GitHub (Feb 11, 2016):
No, never mind. It is in 2.5.
@yceruto commented on GitHub (Feb 11, 2016):
The exception is thrown here, because here
$parentReflFieldsit's empty on first occurrence, I don't see the solucion in your tree reference ??@Adam314 commented on GitHub (May 6, 2016):
I had the same error and found solution. If I provide only class name:
I get this error when running
doctrine:generate:entities. However when I addcolumnPrefix:then it works. :)
@leevigraham commented on GitHub (May 18, 2016):
@Adam314 adding columnPrefix seems to work for one level of embeddable but not multiple.
@binarious commented on GitHub (Sep 27, 2016):
I had to change https://github.com/doctrine/doctrine2/blob/v2.5.5/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php#L930
to
to get this working.
@soullivaneuh commented on GitHub (Dec 8, 2016):
Same issue here but adding
columnPrefixdoes not solve the problem for my case:Installed packages:
Removing the embedded field makes the command work.
@lashus commented on GitHub (Jan 23, 2017):
+1 still not solved in 2017 ^^
@francisw commented on GitHub (Feb 16, 2017):
Lovely workaround @Adam314 the solution (including the columnPrefix) works in 3.2 for one level of embedding
@Majkl578 commented on GitHub (Dec 20, 2017):
EntityGenerator is going to be removed in Doctrine 3.0, sorry that it never got solved.