Sure, I know I'm able to use Interfaces where I want to. I just want to 
know if there is a easier way to do this using the CakePHP Plugins. And if 
isn't, if there is a pattern to use Interfaces and let the CakePHP 
autoinclude them, like it did with the MVC classes.

Thanks,

Vinicius

On Thursday, May 31, 2012 1:07:35 PM UTC-3, jeremyharris wrote:
>
> CakePHP is just PHP, so there's no reason you couldn't use interfaces 
> where you wanted to. The users of the plugins would just need to understand 
> that they need to implement them.
>
> On Thursday, May 31, 2012 4:07:13 AM UTC-7, Vinicius Dusso wrote:
>>
>> Hello all,
>>
>> Did everyone tried to use PHP's Interface as Extension Point in CakePHP? 
>> My idea is to create a fully modular app. To build a menu, for example, I 
>> would be able to do something like this:
>>
>> The method 'getExtensionPoint' will get all the classes that implements 
>> the given interface, at run time.
>>
>> // The core of extension point
>> class MenuController {
>>
>>   function _buildMenu() {
>>     $menu = array();
>>
>>     $menuProviders = $this->getExtensionPoint('IMenu');
>>     foreach($menuProviders as $menuProvider) {
>>       $menu += $menuProvider->getMenu();
>>     }
>>   }
>>
>> }
>>
>> // Some class ( could be a Controller or a Model ) which uses this 
>> extension point
>> class User implements IMenu {
>>
>>   function getMenu() {
>>     return array('Users' => '/user/list');
>>   }  
>>
>> }
>>
>> // The Interface, to bind the extended classes
>> public interface IMenu {
>>   function getMenu();
>> }
>>
>>
>> Sorry for write all this code here. 
>> Someone already did something like this? This can be done using the 
>> plugins in CakePHP ?
>>
>>
>> Thanks in advance !
>>
>>
>> Vinicius
>>
>>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to