zend framework2 - zf2 how to use 3rd party module in my own specific module (based on route)? -
i'm developping website zendframework 2. have 2 modules: module administration called administration(route defined www.mysite.com/admin/...) et module public site called application(route defined www.mysite.com/...) distinguish 2 modules route.
i don't know how distinguish 2 modules based on route.
to create clear, have 2 questions example:
i utilize zfcuser login scheme module administration et in administration/module.php
added next code purpose if 1 user doesn't have identity layout alter login form.
namespace administration; utilize zend\mvc\moduleroutelistener; utilize zend\mvc\mvcevent; class module { public function onbootstrap(mvcevent $e) { $eventmanager = $e->getapplication ()->geteventmanager (); $moduleroutelistener = new moduleroutelistener (); $moduleroutelistener->attach ( $eventmanager ); $eventmanager->attach('dispatch', array($this, 'checkloginchangelayout')); } public function checkloginchangelayout(mvcevent $e) { if (! $e->getapplication ()->getservicemanager ()->get ( 'zfcuser_auth_service' )->hasidentity ()) { $controller = $e->gettarget (); $controller->layout ( 'layout/authentication.phtml' ); } } public function getconfig() { homecoming include __dir__ . '/config/module.config.php'; } public function getautoloaderconfig() { homecoming array ( 'zend\loader\standardautoloader' => array ( 'namespaces' => array ( __namespace__ => __dir__ . '/src/' . __namespace__ ) ) ); } }
but 2 modules affected function checkloginchangelayout()
. want utilize module zfcuser in module administration not module application. can module manager or event manager solve problem?
application.config.php
, 2 modules controlled it. want utilize 3rd party module in module administration not other modules.
your first approach fail
because (as found) there module doing such thing called bjyauthorize
it has config allowing different type of users access controller/action/module/route/...
plz review it's documentation more info , there blog post how bring together zfcuser , bjy . http://samminds.com/2013/03/zfcuser-bjyauthorize-and-doctrine-working-together/
zend-framework2 zfcuser bjyauthorize
No comments:
Post a Comment