You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
storing the Definitions in a file and adding them like $builder->addDefinitions('definitions.php');
using the ocramius\proxy-manager
configuring the DI builder to write the proxies to a file: writeProxiesToFile(true, '/folderName')
Then:
no files are actually generated in the indicated folder
performance drops significantly.
When switching back to non-lazy configured objects, performance is back to normal again. After browsing around in the source code, it seems a FileWriterGeneratorStrategy should also be set explicitly, since it defaults to an EvaluatingGeneratorStrategy which removes the generated files afterwards
The "officially recommended" version is ~1.0 (through docs and https://github.com/PHP-DI/PHP-DI/blob/master/composer.json#L44). suggests is showing its limits here. However it's of course great that we add support for 1.0 and 2.0, it was mentioned in #359 (comment) but I never got around doing it. If you could update your PR to keep the else { $config->setGeneratorStrategy(new EvaluatingGeneratorStrategy()); that way the factory would work with both versions?
If you have time you could also update composer.json and the docs, but if you don't that's not a problem I'll probably have some time later today for that.
If you could update your PR to keep the else { $config->setGeneratorStrategy(new EvaluatingGeneratorStrategy()); that way the factory would work with both versions?
Done!
If you have time you could also update composer.json and the docs, but if you don't that's not a problem I'll probably have some time later today for that.
Don't know whether that is still required, both versions are supported now right ? 😄
When:
$builder->addDefinitions('definitions.php');
ocramius\proxy-manager
writeProxiesToFile(true, '/folderName')
Then:
When switching back to non-lazy configured objects, performance is back to normal again. After browsing around in the source code, it seems a
FileWriterGeneratorStrategy
should also be set explicitly, since it defaults to anEvaluatingGeneratorStrategy
which removes the generated files afterwardsAdding one line to the
ProxyFactory
PHP-DI/src/DI/Proxy/ProxyFactory.php
Lines 72 to 74 in c6c932e
Also opened #412
The text was updated successfully, but these errors were encountered: