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.
Essentially, if your abstract factory returns anything other than an object, the SM moves on to the next abstract factory. This means that if a later AF returns a value, that will be used, or, if whatever the last AF returns, regardless of type, will be returned.
As an example, if we register 3 abstract factories, and each return arrays, the last AF's value will be returned, even though the first clearly returned a value. This is inconsistent with factories, where any non-null value may be returned as a service, which is in turn inconsistent with how setService() works (only arrays and objects are valid).
At the very least, createFromAbstractFactory should return immediately if a non-null value is returned by a give abstract factory. Better yet, we should also loosen up how setService() works, to allow setting the same type range as factories do.
The text was updated successfully, but these errors were encountered:
See this line: https://github.com/zendframework/zf2/blob/master/library/Zend/ServiceManager/ServiceManager.php#L1040-L1042
Essentially, if your abstract factory returns anything other than an object, the SM moves on to the next abstract factory. This means that if a later AF returns a value, that will be used, or, if whatever the last AF returns, regardless of type, will be returned.
As an example, if we register 3 abstract factories, and each return arrays, the last AF's value will be returned, even though the first clearly returned a value. This is inconsistent with factories, where any non-null value may be returned as a service, which is in turn inconsistent with how
setService()
works (only arrays and objects are valid).At the very least,
createFromAbstractFactory
should return immediately if a non-null value is returned by a give abstract factory. Better yet, we should also loosen up how setService() works, to allow setting the same type range as factories do.The text was updated successfully, but these errors were encountered: