ZF2 Autoloader: Use factory for base class on extended classes as well
问题 If I wanted to use the same factory for any class that extended my base class, would I want to turn the base class factory into a named function, or is there a better way to do this? $serviceManager => array( 'factories' => array( 'someBaseClass' => function($thisServiceManager) { $db = $thisServiceManager->get('db'); $thisBaseClass = new \myNamespace\thisBaseClass($db); return $thisBaseClass; }, ), ); EDIT Further to the answer I accepted, here's the code I've tested that works. Class File