/**
  * Create Service Factory
  * 
  * @param ServiceLocatorInterface $serviceLocator
  */
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $sm = $serviceLocator->getServiceLocator();
     $service = $sm->get('Blog\\Service\\Blog');
     $controller = new BlogController();
     $controller->setBlogService($service);
     return $controller;
 }
 /**
  * Returns BlogController instance.
  *
  * @param ServiceLocatorInterface $serviceLocator
  * @return BlogController
  * @override
  **/
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     /* @var $serviceLocator Zend\Mvc\Controller\ControllerManager */
     $sm = $serviceLocator->getServiceLocator();
     $em = $sm->get('em');
     $service = new PostService($em);
     $controller = new BlogController();
     $controller->setEntityManager($em);
     $controller->setPostService($service);
     $acl = new Acl();
     $acl->addRole(new Role(UserService::ROLE_GUEST));
     $acl->addRole(new Role(UserService::ROLE_ADMIN));
     $acl->addResource($controller);
     $acl->allow(UserService::ROLE_ADMIN, $controller);
     $acl->allow(UserService::ROLE_GUEST, $controller);
     $acl->deny(UserService::ROLE_GUEST, $controller, array('create', 'edit', 'view-all'));
     $controller->setAcl($acl);
     return $controller;
 }