mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
orm:ensure-production-settings incorrectly reports that proxy classes are always generated
#5519
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 @BrandonDusseau on GitHub (May 4, 2017).
The console tool
orm:ensure-production-settingsappears to report that "Proxy Classes are always regenerating" when the proxy mode is set toAbstractProxyFactory::AUTOGENERATE_FILE_NOT_EXISTS.This is due to the use of a check for truthy values rather than strict checks for boolean
trueor the constantAbstractProxyFactory::AUTOGENERATE_ALWAYS:This may be one of two situations: either this is a bug and the production readiness tool is misreporting this case, or the string returned by the tool is simply misleading ("... are always regenerating.").
This affects Doctrine 2.5.6.
@Ocramius commented on GitHub (May 5, 2017):
I think the tool simply wasn't adapted to the new
AbstractProxyFactory::AUTOGENERATE_FILE_NOT_EXISTSStill, writing files in prod is not suggested, even if they are written only once. If your production environment is being hammered, the first requests will fight for writing to that location, and some may fail, so this check should probably stay as-is...
@BrandonDusseau commented on GitHub (May 5, 2017):
I think that's fine, but in that case I'd suggest changing the wording on that tool's return value. I lost over an hour at work trying to diagnose why it said proxies were always being generated when I did not have it set to do so. I'm probably not going to be the only case of that happening.
Also I did choose to never auto generate in production prior to filing the bug.
@Ocramius commented on GitHub (May 8, 2017):
The wording needs to be changed, yes. Do you have any suggestions for which phrase to use for each of these flags?
@BrandonDusseau commented on GitHub (May 11, 2017):
Some simple suggestions:
AUTOGENERATE_NEVER: No message, this is okay.AUTOGENERATE_ALWAYS: "Proxy classes are always regenerating and will cause performance degradation."AUTOGENERATE_FILE_NOT_EXISTS: "Proxy classes auto-generate if not already existing, which may lead to performance degradation or failure under load."AUTOGENERATE_EVAL: I'm not really sure how this one works. Given the comment on it in the code, maybe a message about how it's questionable?Sorry for the delay!
@alcaeus commented on GitHub (May 11, 2017):
IIRC,
AUTOGENERATE_EVALbehaves likeAUTOGENERATE_ALWAYS, except that the generated code is not written to the file system then included, but run usingeval. I'd give it a similar message asAUTOGENERATE_ALWAYS.@Ocramius commented on GitHub (May 16, 2017):
AUTOGENERATE_EVALshould indeed not be run in production, but at least it won't fry your drives :-)