public function createService(ServiceLocatorInterface $serviceLocator) { $chain = new AdapterChain(); $options = $this->getOptions($serviceLocator); //iterate and attach multiple adapters and events if offered foreach ($options->getAuthAdapters() as $priority => $adapterName) { $adapter = $serviceLocator->get($adapterName); if (is_callable(array($adapter, 'authenticate'))) { $chain->getEventManager()->attach('authenticate', array($adapter, 'authenticate'), $priority); } if (is_callable(array($adapter, 'logout'))) { $chain->getEventManager()->attach('logout', array($adapter, 'logout'), $priority); } } return $chain; }
public function createService(ServiceLocatorInterface $serviceLocator) { $chain = new AdapterChain(); $adapter = $serviceLocator->get('ZfcUser\\Authentication\\Adapter\\Db'); $chain->getEventManager()->attach('authenticate', array($adapter, 'authenticate')); return $chain; }