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
{{ message }}
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.
//below returns "boo1", but expects "boo2"
var_dump($parent->get("foo1"));
Case scenario 2
$sm = new ServiceManager( );
$sm->setService("foo1", "boo1");
$sm2 = new ServiceManager();
$sm2->setRetrieveFromPeeringManagerFirst(true);
$sm2->setService("foo1", "boo2");
$sm2->addPeeringServiceManager($sm);
//below returns "boo2", but expects "boo1"
var_dump($sm2->get("foo1"));
The reason is that get(), firstly tries to retrieve instance from parent and than does search in peering SM.
Possible solution:
Would be change that firstly to search in peering SM and than try to get from parent $instances.
The possible headache:
SM = ServiceManager, picture that you have:
SM1 has child SM2, and both of them have retrieveFromPeeringManagerFirst() set to true.
SM2 has child SM3
SM1, SM2 and SM3 have key 'foo1'.
SM1 does not have control over SM2, but expects to have 'foo1' from SM2, but will get from SM3. It brings some headache for user over control for retrieving from peering.
The text was updated successfully, but these errors were encountered:
Link to open discussion: http://zend-framework-community.634137.n4.nabble.com/In-ServiceManager-for-peering-strange-behavior-td4658667.html#a4658671
Case scenario 1
$child = new ServiceManager();
$parent = $child->createScopedServiceManager();
$parent->setRetrieveFromPeeringManagerFirst(true);
$parent->setAllowOverride(true);
$child->setService("foo1", "boo2");
$parent->setService("foo1", "boo1");
//below returns "boo1", but expects "boo2"
var_dump($parent->get("foo1"));
Case scenario 2
$sm = new ServiceManager( );
$sm->setService("foo1", "boo1");
$sm2 = new ServiceManager();
$sm2->setRetrieveFromPeeringManagerFirst(true);
$sm2->setService("foo1", "boo2");
$sm2->addPeeringServiceManager($sm);
//below returns "boo2", but expects "boo1"
var_dump($sm2->get("foo1"));
The reason is that get(), firstly tries to retrieve instance from parent and than does search in peering SM.
Possible solution:
Would be change that firstly to search in peering SM and than try to get from parent $instances.
The possible headache:
SM = ServiceManager, picture that you have:
SM1 has child SM2, and both of them have retrieveFromPeeringManagerFirst() set to true.
SM2 has child SM3
SM1, SM2 and SM3 have key 'foo1'.
SM1 does not have control over SM2, but expects to have 'foo1' from SM2, but will get from SM3. It brings some headache for user over control for retrieving from peering.
The text was updated successfully, but these errors were encountered: