Skip to content

Instantly share code, notes, and snippets.

@diego-mi
Created September 22, 2015 11:00
Show Gist options
  • Save diego-mi/38c905fc1afa1fac0a67 to your computer and use it in GitHub Desktop.
Save diego-mi/38c905fc1afa1fac0a67 to your computer and use it in GitHub Desktop.
<?php
namespace Auth\Authentication\Factory;
use Auth\Authentication\Adapter;
use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
use Zend\Authentication\AuthenticationService;
use Zend\Authentication\Storage\Session;
class AuthenticationFactory implements FactoryInterface
{
/**
* Create service
*
* @param ServiceLocatorInterface $serviceLocator
* @return mixed
*/
public function createService(ServiceLocatorInterface $serviceLocator)
{
$entityManager = $serviceLocator->get('Doctrine\ORM\EntityManager');
$adapter = new Adapter($entityManager);
$adapter->setEm($entityManager);
return new AuthenticationService(
new Session(),
$adapter
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment