Generic factory method pattern for Zend Framework 2 serviceLocator
Hello all,
I noticed that new versions of PhpStorm include this nice feature: http://confluence.jetbrains.com/display/PhpStorm/PhpStorm+Advanced+Metadata
That page explains how to deal with static method. However, in ZF2, I continually type things like:
$object = $this->getServiceLocator()->get('someFactoryName');
Is there a way to map someFactoryName to a class so autocomplete can work on $object in the metadata file?
Thanks,
Dejan
Please sign in to leave a comment.
Hi there,
Automatically (like it's done for static methods, e.g. Mage::getModel('admin/user'); ) -- No (since ATM it's implemented for static methods only).
I guess when http://youtrack.jetbrains.com/issue/WI-10959 will be implemented, this would work for ZF as well.
In meantime -- only manual code hinting, e.g.
Thanks for the quick reply! Ok, I'll wait patiently for this feature :)