In order to get my object manager inside my fieldset's init() function I
followed the docs:
http://framework.zend.com/manual/2.1/en/modules/zend.form.advanced-use-of-forms.html#the-specific-case-of-initializers
<http://framework.zend.com/manual/2.1/en/modules/zend.form.advanced-use-of-forms.html#the-specific-case-of-initializers>
  

At first I found out that I had to change

to

otherwise I got an error:
*setServiceLocator() must be compatible with that of
Zend\ServiceManager\ServiceLocatorAwareInterface::setServiceLocator()*

When calling $this->getServiceLocator() I get an instance of the
FormManager.
Additionally calling $this->getServiceLocator()->getServiceLocator() returns
NULL.

Since I am still new to DI I wonder if I am missing a place to inject?

Testing I switched from

to


Since then I get this error:
*exception 'Zend\Di\Exception\RuntimeException' with message 'Invalid
instantiator of type "NULL" for
"Zend\ServiceManager\ServiceLocatorInterface".'
An abstract factory could not create an instance of
applicationformmyform(alias: Application\Form\MyForm).*
 
Anyway reading some other threads using the ServiceLocator Awareness isn't
recommended. Is using the *FormElementProviderInterface* the alternative?




-----
http://www.webdevilopers.net
https://www.facebook.com/webdevilopers
http://www.twitter.com/webdevilopers
--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/Getting-objectManager-serviceLocator-in-fieldset-tp4659331.html
Sent from the Zend Framework mailing list archive at Nabble.com.

-- 
List: [email protected]
Info: http://framework.zend.com/archives
Unsubscribe: [email protected]


Reply via email to