-
-
Notifications
You must be signed in to change notification settings - Fork 454
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
[Autoloader] Dev mode warmups proxy classes for mappedSuperclass, prod does not #848
Comments
Moved from symfony/symfony#28379 |
Hi. Does somebody knows how to resolve the issue? Project team members at work are still doing mistakes in mapping and it makes the application unstable in |
@blackandred can you create a minimal example application that allows to reproduce this issue? |
As @dmaicher said, a reproducer would be helpful here. At first, there shouldn't be an obvious difference between environments. Of course, having different values for the With So, I believe the error is not in whether mapped superclasses are generated or not, because ORM is pretty clear on that: they should not have proxies generated. However, something in your prod environment is trying to create a proxy for a mapped superclass, which doesn't exist. The autoloader then tries to generate the proxy before requiring the file. However, the autoloader never checks whether a file was actually generated. A sanity check there would be useful, but it wouldn't solve the problem at hand: it would simply throw an exception instead of letting the fatal error blow up. I believe in this case, you should try to reproduce why ORM is trying to create a proxy for a mapped superclass, so this can be fixed in ORM: according to doctrine/orm#3337, a proxy for a mapped superclass doesn't make sense, so the issue has to be somewhere in your code or your mapping. I've created doctrine/common#870 to tighten the error handling in the proxy autoloader, but I believe the issue is in ORM. I'm closing this here, but please report back here or in the [https://github.com/doctrine/orm/issues](ORM issue tracker) once you have a reproducer that you'd like us to look at 👍 |
Hi, thanks for engagement. Sorry, actually I do not have a use case to
reproduce the issue, it was reported long time ago.
…On Thu, Apr 11, 2019 at 10:27 AM Andreas Braun ***@***.***> wrote:
As @dmaicher <https://github.com/dmaicher> said, a reproducer would be
helpful here. At first, there shouldn't be an obvious difference between
environments. Of course, having different values for the
orm.auto_generate_proxy_classes configuration option causes subtle
difference in behaviour:
With auto_generate_proxy_classes set to false, the ProxyCacheWarmer will
generate proxy classes and the autoloader will skip it; this is reversed
with auto_generate_proxy_classes set to true. However, there should
*never* be a proxy for a mapped superclass, as the ProxyFactory in ORM
skips any mapped superclass, embedded class or abstract class:
https://github.com/doctrine/orm/blob/52d806a34a12b743a224bc70f506a991f0b36c7e/lib/Doctrine/ORM/Proxy/ProxyFactory.php#L94
.
So, I believe the error is not in whether mapped superclasses are
generated or not, because ORM is pretty clear on that: they should not have
proxies generated. However, something in your prod environment is trying to
create a proxy for a mapped superclass, which doesn't exist. The autoloader
then tries to generate the proxy before requiring the file. However, the
autoloader never checks whether a file was actually generated. A sanity
check there would be useful, but it wouldn't solve the problem at hand: it
would simply throw an exception instead of letting the fatal error blow up.
I believe in this case, you should try to reproduce why ORM is trying to
create a proxy for a mapped superclass, so this can be fixed in ORM:
according to doctrine/orm#3337
<doctrine/orm#3337>, a proxy for a mapped
superclass doesn't make sense, so the issue has to be somewhere in your
code or your mapping.
I've created doctrine/common#870
<doctrine/common#870> to tighten the error
handling in the proxy autoloader, but I believe the issue is in ORM. I'm
closing this here, but please report back here or in the [
https://github.com/doctrine/orm/issues](ORM issue tracker) once you have
a reproducer that you'd like us to look at 👍
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#848 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AVwEhq4YlX_xDx4K1oFjwmJxFNE19zxEks5vfvH3gaJpZM4Wtvl1>
.
|
i also have this error, when switch symfony to prod mod, then proxies to mappedSuperclass wasn't generated and then i have error
|
@toar86 see the explanation above. You would need to investigate the stack trace to find out why such a proxy for a mapped superclass was requested at all. |
Symfony version(s) affected: 4.1.2
Description
Hello, I'm developing an application with an inherited structure of modules -> components (DDD like).
I felt an inconsistency between
dev
andprod
mode, the invalid code was working indev
but when running inprod
was showing runtime errors (not on build stage).How to reproduce
I suspect this situation (it is incorrect in my perspective):
The problem is that in
dev
mode the proxy class formappedSuperclass
was generated... but it shouldn't or I'm wrong?In
prod
mode the cache warmup was green, but the application were saying that failed to include() a non-existing file (it was trying to include a proxy class formappedSuperclass
Possible Solution
Make the
dev
validation better in this case?The text was updated successfully, but these errors were encountered: