[fw-general] Re: [ZF2] What's the proper way to register global MVC plugins?

2012-02-27 Thread Marco Pivetta
You can still define your Acl service and put it in your Di config with all of its requirements. Then you can inject it into your controller either as hard dependency (constructor parameter) or via setter injection. Marco Pivetta http://twitter.com/Ocramius http://marco-pivetta.com On 27

Re: [fw-general] Re: [ZF2] What's the proper way to register global MVC plugins?

2012-02-27 Thread Matthew Weier O'Phinney
-- cmple roman.vidya...@gmail.com wrote (on Sunday, 26 February 2012, 07:32 PM -0800): But this means that I'll have to add $this-myAcl()-isAllowed() in every controller which makes my code redundant. Is there a way to use it globally(a single class available to all) ? maybe via DI instead of

[fw-general] Re: [ZF2] What's the proper way to register global MVC plugins?

2012-02-27 Thread cmple
Marco Pivetta wrote You can still define your Acl service and put it in your Di config with all of its requirements. Then you can inject it into your controller either as hard dependency (constructor parameter) or via setter injection. Marco Pivetta http://twitter.com/Ocramius

[fw-general] Re: [ZF2] What's the proper way to register global MVC plugins?

2012-02-27 Thread Marco Pivetta
Nope, what I gave you is a service you could inject to check your ACL within the controllers. If you want to restrict acces in your application, then use Matthew's example, which is an event happening at 'dispatch' and which does exactly that, without copy/paste in every example. Marco Pivetta

[fw-general] Re: [ZF2] What's the proper way to register global MVC plugins?

2012-02-27 Thread cmple
weierophinney wrote -- cmple lt;roman.vidyayev@gt; wrote (on Sunday, 26 February 2012, 07:32 PM -0800): But this means that I'll have to add $this-myAcl()-isAllowed() in every controller which makes my code redundant. Is there a way to use it globally(a single class available to all) ?

Re: [fw-general] Re: [ZF2] What's the proper way to register global MVC plugins?

2012-02-27 Thread Matthew Weier O'Phinney
-- cmple roman.vidya...@gmail.com wrote (on Monday, 27 February 2012, 08:17 AM -0800): weierophinney wrote -- cmple lt;roman.vidyayev@gt; wrote (on Sunday, 26 February 2012, 07:32 PM -0800): But this means that I'll have to add $this-myAcl()-isAllowed() in every controller which makes my

[fw-general] Re: [ZF2] What's the proper way to register global MVC plugins?

2012-02-27 Thread cmple
weierophinney wrote -- cmple lt;roman.vidyayev@gt; wrote (on Monday, 27 February 2012, 08:17 AM -0800): weierophinney wrote -- cmple lt;roman.vidyayev@gt; wrote (on Sunday, 26 February 2012, 07:32 PM -0800): But this means that I'll have to add $this-myAcl()-isAllowed() in every

Re: [fw-general] Re: [ZF2] What's the proper way to register global MVC plugins?

2012-02-27 Thread Matthew Weier O'Phinney
-- cmple roman.vidya...@gmail.com wrote (on Monday, 27 February 2012, 12:13 PM -0800): weierophinney wrote -- cmple lt;roman.vidyayev@gt; wrote (on Monday, 27 February 2012, 08:17 AM -0800): weierophinney wrote -- cmple lt;roman.vidyayev@gt; wrote (on Sunday, 26 February 2012,

[fw-general] Re: [ZF2] What's the proper way to register global MVC plugins?

2012-02-27 Thread cmple
weierophinney wrote Simply alter the RouteMatch -- since you're doing this as a high-priority dispatch listener, the controller hasn't yet been retrieved from the locator. This means you can do something like this: $matches-setParam('controller', 'Alternate\Controller\Classname');

[fw-general] Re: [ZF2] What's the proper way to register global MVC plugins?

2012-02-26 Thread cmple
Marco Pivetta wrote You can check https://github.com/ZF-Commons/ZfcUser/blob/master/src/ZfcUser/Controller/Plugin/ZfcUserAuthentication.php and https://github.com/ZF-Commons/ZfcUser/blob/master/config/module.config.php#L63 Marco Pivetta http://twitter.com/Ocramius

[fw-general] Re: [ZF2] What's the proper way to register global MVC plugins?

2012-02-26 Thread Marco Pivetta
As you can see from the plugin I've linked, plugins are just registered in the pluginLoader. I would just create a new plugin class extending the AbstractPlugin as ZfcUserAuthentication does and then map it to myAcl for examle. Then you should be able to use it with $this-myAcl()-isAllowed() in

[fw-general] Re: [ZF2] What's the proper way to register global MVC plugins?

2012-02-26 Thread cmple
Marco Pivetta wrote As you can see from the plugin I've linked, plugins are just registered in the pluginLoader. I would just create a new plugin class extending the AbstractPlugin as ZfcUserAuthentication does and then map it to myAcl for examle. Then you should be able to use it with

[fw-general] Re: [ZF2] What's the proper way to register global MVC plugins?

2012-02-25 Thread cmple
HHGAG wrote Here's a tutorial: http://akrabat.com/getting-started-with-zend-framework-2/ Its a great tutorial but it has nothing to do with plugins -- View this message in context:

Re: [fw-general] Re: [ZF2] What's the proper way to register global MVC plugins?

2012-02-25 Thread Marco Pivetta
You can check https://github.com/ZF-Commons/ZfcUser/blob/master/src/ZfcUser/Controller/Plugin/ZfcUserAuthentication.php and https://github.com/ZF-Commons/ZfcUser/blob/master/config/module.config.php#L63 Marco Pivetta http://twitter.com/Ocramius http://marco-pivetta.com On 26 February 2012

[fw-general] Re: [ZF2] What's the proper way to register global MVC plugins?

2012-02-24 Thread cmple
juhasuni, did you find the solution? I'd also like to know Thanks, juhasuni wrote Hello, Is there a correct way to register custom MVC plugins that should be accessible from all controllers implementing the Pluggable interface? ZF introduces few plugins by default and those are

[fw-general] Re: [ZF2] What's the proper way to register global MVC plugins?

2012-02-24 Thread HHGAG
Here's a tutorial: http://akrabat.com/getting-started-with-zend-framework-2/ - Hasan H. Gürsoy (HHGAG) -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/ZF2-What-s-the-proper-way-to-register-global-MVC-plugins-tp4265227p4418281.html Sent from the Zend