Hi Everyone.

First, thanks for your help.

I have a ZF2 build that uses Gearman, all Gearman functions exist in a
custom namespace whose classes extend a custom GearmanService parent class
(that implements ServiceLocatorAwareInterface).  It's a set up I am happy
with, I can just drop a class that extends GearmanService and it is
automatically registered by a CLI route that loads in all the functions into
workers.  (ZF2 was a treat to work with in setting this up)

During the worker load-in, it pretty much does a:

$w = new \GearmanWorker();
$array_of_strings = GearmanService::getClassNames();
foreach( $array_of_strings as $s )
{
    $n = $this->getServiceLocator()->get( $s );
    $n->registerWithWorker( $w );
}


GearmanService::getClassNames() recursively iterates through all files in
the folder associated to the namespace and returns them as an array.  That
works well.  The PITA is loading in the same class names into the invokables
section of the service_manager part of the config.

It'd be nicer if there were some sentient factory available that could just
recognize the "get" as an instance of GearmanService and return the right
object.  This possible?

Thanks for your help





--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/Service-Manager-Factory-to-replace-all-these-invokables-tp4658880.html
Sent from the Zend Framework mailing list archive at Nabble.com.

-- 
List: fw-general@lists.zend.com
Info: http://framework.zend.com/archives
Unsubscribe: fw-general-unsubscr...@lists.zend.com


Reply via email to