-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[DI] Allow dumping the container in one file instead of many files #32119
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's for 4.4, it's a new feature :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I have reworked this PR. there was a bug (did not worked in env test), now it's 👍
Bonus: Now it's only affect the kernel, not the DIC \o/
4ab8996
to
32563e5
Compare
The diff is easier to read thank to |
Are you OK with this one? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
still for 4.4 to me, sorry about that :)
OK, I have added a test, and addressed your comments. |
Many issue about this: * Kernel does not handle when the dumper returns a string * Kernel does not handle when the compiled Container file does not return a new instance of itself * Kernel try to old load and clean old container, but if the container does not change its name, it tries to load 2 time the same file, and so the same class This patch fixed all theses case. Now we can use with ease a multifiles container or a simple unique file.
I rebased this PR. It's now ready and green 💚 |
c95a05a
to
d5702c3
Compare
I pushed a completely different implementation on your branch: instead of patching the Kernel (I kept your cleanup), this now patches the PhpDumper. This allows keeping the anonymous class proxy, which is desired to have safe cache clears. See updated PR description. |
a62b056
to
45bf554
Compare
@nicolas-grekas What about the cleaning ? |
…f many files (nicolas-grekas) This PR was merged into the 4.4 branch. Discussion ---------- [DI] Allow dumping the container in one file instead of many files | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - Replaces #32119 As spotted by @lyrixx, putting all service factories in one big container can be easier to manage with workers. It could also play well with PHP7.4's preloading. This PR adds a `container.dumper.inline_factories` parameter to enable this behavior. When it is set to true, a single big container file is created. Commits ------- c893986 [DI] Allow dumping the container in one file instead of many files
Replaced by #32581