-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Undefined alias for Embeddable in 2.7.1 #8031
Comments
Hi, I have the same problem. After some investigation, I found out that the mapping now adds an inherited key to the fieldMapping for the Embeddable who have a superclass. This result in the following code to think $tableName = (isset($mapping['inherited']))
? $this->em->getClassMetadata($mapping['inherited'])->getTableName()
: $class->getTableName(); This code is found in the SqlWalker at the line 1397. |
I've tried to create a failing test case (#8036) but it's not failing 👀 @vicdelfant @Exalyon could you please take a look and tell me what I'm doing wrong in the test? |
All right, got it failing with repository's |
You beat me to it @malarzm :) Thanks for looking into this! |
One thing I've found out is that if |
It also breaks the proxies generation process for me and I end up with the ReflectionException in RuntimeReflectionService.php at line 75 - Reverting the #8006 locally fixed the issue for me. |
@jaroslavlibal with "proxy generation process" you mean casual proxy generation with provided command? Do you also have embeddables that inherit from other embeddables? |
@malarzm Yes, exactly - A
|
@jaroslavlibal would you mind testing if #8036 fixes your issue as well? I couldn't come up with an easy-enough test for your case but I my patch should bring back status quo. Although having embeddable which contains another embeddable sounds weird and unsupported as according to docs embeddables can contain only columns 🤔 |
@malarzm Unfortunately I have to inform that it haven't resolved my issue. I have probably overlooked (years ago) the information that embeddables can contain only columns; however the information itself was not entirely true as embeddables containing embeddables worked well until the current version 😟 We considered embeddables as value objects, which can contain another value objects (and columns). The problem does not occur with embeddables which contains another embeddables, when no inheritance is used (eg. |
@jaroslavlibal i am not sure about embeddables can't contain embeddables, I believe it was added at some point, so that is why its working for you. We should be able to fix it, or revert, so no worries :) |
@jaroslavlibal i have reproduced your problem on top of @malarzm PR. |
@jaroslavlibal there was already a workaround about nested and inheritence in the code that broke the right fix in #8006. I disabled that workaround in a new commit to the #8036 PR. Can you verify that fixes your problem? |
@beberlei Yes, pulling |
…8006 (#8036) * Add test case * Treat parent embeddables as mapped superclasses * [GH-8031] Bugfix: Get working again on nested embeddables in inherited embeddables. * Housekeeping: CS * Update note on limitations * [GH-8031] Verify assocations still do not work with Embeddables. * Housekeeping: CS Co-authored-by: Benjamin Eberlei <[email protected]>
Fixed in #8036 |
Bug Report
Summary
2.7.1
seems to (partially) break support for embedded properties, resulting in a "column not found" exception. Reverting to2.7.0
without any other code changes fixes this. The cause seems to be the use of an undefined alias for fetching the embeddable's properties.Current behavior
The
a1_
alias is introduced without being defined, generating the following SQL:This results in the following exception:
How to reproduce
Upgrade to
2.7.1
and use the following entity and embeddable. The entity and embeddable are trimmed for readability but you get the gist:Entity
Embedded
Expected behavior
The existing
o0_
alias is re-used, resulting in the following SQL:The text was updated successfully, but these errors were encountered: