Skip to content
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

Second strategy override first one when adding two identical strategies #72

Closed
improved-broccoli opened this issue Sep 15, 2015 · 3 comments

Comments

@improved-broccoli
Copy link

In my case, I needed two host strategies. The domain could vary according to locale.
So I tried to set up, two host strategies with different parameters.
But when the strategies was added, the second one overlapped the first one. That's because strategy is pull from strategy plugin manager which gives you a reference to the object, not a new one.

@basz
Copy link
Owner

basz commented Sep 15, 2015

could you post (gist.github.com) your config please.

one solution that comes to mind is to set the 'shared' flag on the https://github.com/juriansluiman/SlmLocale/blob/master/src/SlmLocale/Strategy/StrategyPluginManager.php#L52 to false.

@improved-broccoli
Copy link
Author

Your solution is the right one. I set shareByDefault to false: protected $shareByDefault = false; in a custom strategy plugin manager inherited from strategyPluginManager and that works.
@juriansluiman Should we set this by default to false in strategyPluginManager since it does not break current tests?

@svycka
Copy link
Collaborator

svycka commented May 22, 2017

@jbenoit2011 I think default behavior is correct you don't have to change this in StrategyPluginManager you can set this in your config zend-servicemanager documentation https://zendframework.github.io/zend-servicemanager/configuring-the-service-manager/#shared

@svycka svycka closed this as completed May 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants