Skip to content

Instantly share code, notes, and snippets.

@diego-mi
Created September 22, 2015 10:58
Show Gist options
  • Save diego-mi/76b29ef0eedd3558868e to your computer and use it in GitHub Desktop.
Save diego-mi/76b29ef0eedd3558868e 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');
return new AuthenticationService(
new Session(),
new Adapter($entityManager)
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment