Skip to content

Instantly share code, notes, and snippets.

@intellix
Created July 22, 2013 10:38
Show Gist options
  • Save intellix/6052927 to your computer and use it in GitHub Desktop.
Save intellix/6052927 to your computer and use it in GitHub Desktop.
ServiceManager into Service models
public function getServiceConfig()
{
return array(
'factories' => array(
'Application\Service\PlayerService' => function ($sm) {
$model = new Service\PlayerService($sm);
return $model;
}
)
);
}
<?php
namespace Application\Service;
class PlayerService
{
private $sm;
public function __construct ($sm)
{
$this->sm = $sm;
}
public function register(Entity\User $user)
{
$identity = $this->sm->get('Zend\Authentication\AuthenticationService');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment