Created
June 14, 2013 07:25
-
-
Save whisher/5780088 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace FbswitBlog\Controller\Plugin; | |
use Zend\Mvc\Controller\Plugin\AbstractPlugin; | |
use FbswitBlog\Service\Category as CategoryService; | |
class FbswitBlogService extends AbstractPlugin | |
{ | |
protected $categoryService; | |
public function getCategoryService() | |
{ | |
return $this->categoryService; | |
} | |
public function setCategoryService(CategoryService $service) | |
{ | |
$this->categoryService = $service; | |
return $this; | |
} | |
} | |
//MY Module | |
public function getControllerPluginConfig() | |
{ | |
return array( | |
'factories' => array( | |
'fbswitBlogService' => function ($sm) { | |
$serviceLocator = $sm->getServiceLocator(); | |
$controllerPlugin = new Controller\Plugin\FbswitBlogService(); | |
$controllerPlugin->setCategoryService($serviceLocator->get('fbswitblog_category_service')); | |
return $controllerPlugin; | |
}, | |
), | |
); | |
} | |
// From within my controller | |
$this->fbswitBlogService(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment