-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Pass settings to Pimple #1457
Pass settings to Pimple #1457
Conversation
This allows a user to configure the container via settings. Fixes #1407
You are a rockstar :) 👍 |
👍 |
{ | ||
parent::__construct(); | ||
parent::__construct($values); |
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.
Is it me or would we be passing settings to Pimple then replacing it right after on line 71?
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.
Yeah it does appear that it will get passed in twice. but only the ['settings'] part of the user provided array.
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.
It's laziness on my part to avoid changing the default settings merging. Will see if I can tidy it up.
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.
Nah leave it, its probably quicker to replace it twice than to pop it off the array. Will merge, you can cleanup later if you wish.
Unfortunately, this PR doesn't have backward compatibility. Before I was able to "override" container values before Before I was able to do the following in unit tests:
Now it is not possible, getting following error:
And main problem is that now you freeze almost all container variables during router initialisation: Before it was (worked perfectly):
Not it is:
As you can see, now you access $c['request'], which automatically freezes almost all essential components in container. |
Main idea is that essential container components, such as Use case:
|
@yurevichcv Please open a new issue as it may be related to #1443 rather than this PR. |
This has been the case before this change was made, you probably just didn't notice it before. Services are frozen from the minute they get called, this is how Pimple works. |
Yes, sorry, you are right. This PR caused the problem - #1443 |
@silentworks Yes, I know how Pimple works. But The same issue was in Twig-View extension, where I also sumbmitted my PR against |
@yurevichcv you are free to overwrite the defaults at any time during execution by simply overwriting the default container instance like this.
|
This allows a user to configure the container via settings.
Fixes #1407