Fix notices and failure of deploy static content #7059
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
System notes
The following is run on
develop
branchdeveloper
The Error
The problem
I think this issue was introduced with this section of code which adds a fake cache class for static content deployments: DeployStaticContentCommand.php#L493
This calls configure on the object manager which has a constructor like
see ObjectManager/Config/Compiled.php#L34 for more
As the fake cache command only passes in the
preferences
argument we get a notice forarguments
and we'd get one forinstanceTypes
if it got that far. Even if we suppress notices things still won't work, as we'd be wiping out all the legitimate configuration for the di config.The solution
I think the solution for this would be to do a selective update of the diConfig so that we're only mocking out the cache class and leaving the remainder untouched.
To do this I had to expose the entirety of the
arguments
stored in the config. This seems to allow the command to run and do its thing. After a di recompile the world seemed to be working again.A caveat, this is my first foray into the M2 configuration and DI system, my solution could be totally whack. Feel free to say point me in the correct direction if I'm doing something silly 👍