Re: Using models with plugins in CakePHP 1.2
Just noticed this post about the new dot notation in 1.2 which seems to address some of these issues. http://groups.google.com/group/cake-php/browse_thread/thread/57afc2867ee1762a/17895d05b0a65397?lnk=gst&q=plugins+dot# --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Using models with plugins in CakePHP 1.2
> Correct me if I am wrong, but it seems some are using plugins to > organize parts of a larger application. To me, you are on a slippery > slope here to basically negating the whole benefit of a plugin and > just making it more work on yourself. Using the config/bootstrap.php > to organize your MVC requires a lot less code and should yield the > same benefits. This is the first I've heard of this, although I can see the sense in gwoo's words. Plugins need to be independant, or they can't be easily distributable from app to app or developer to developer. So, I guess gwoo is right, I had intended to use plugins to organize parts of a larger application. Sounds like many others also thought this way. My goal really was to make an application shell comprised of "plugins" or whatever you want to call them, and just plugin which ever plugins I needed for the client, then supplement with whatever client specific glue or app code was needed. Since plugins are not meant to be used this way, and we should be using the bootstrap.php approach, I guess I need to understand that approach better. What does it entail? Can we still place our (let's call it) "addon" in a single folder and point cake in such a way as to find the addon's controllers, models, views, helpers, components, etc? Can the addon's controllers access the main app's models? What about images and stuff normally stored in webroot? Can the addon- specific files be placed in the addon folder, and is there a way to enable the user's browser to be able to download the addon specific images? Guess I'm short on understanding how to organize code for "addons" which can access the main app, and the main app can access it's code, yet still keep everything related to the "addon" in a single folder. I supposed it can be done somehow with routes, but not sure that is the cleanest way. Hopefully gwoo or someone else can explain (in a little more detail than gwoo's post above) how this might be done? I haven't seen anything related to this on this forum or in the manual, so it might be of benefit to people. BTW - I have lots of trust in the approaches chosen by the emminent cake developers until now in so many areas, so am not at all criticizing. Just trying to wrap my head around something I have not seen explained in the year or so I've been following this discussion group. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Using models with plugins in CakePHP 1.2
Yes, it doesn't seem fair that just because I'm using a certain Model from my app controller, that makes my plugin not work because its AppModel extends my main app model and it can't find the one I'm trying to use. Is there no way around this? On Nov 17, 11:00 am, Aaron Shafovaloff <[EMAIL PROTECTED]> wrote: > I'd have to agree with some folks here---it'd be great if plugins > could "plugin" into the existing application and have access to the > main app's models, etc. > > Perhaps plugins could be split into two types? One of the reasons > Wordpress is so popular is itspluginsystem (which tap into the > larger app). It'd be nice if CakePHP made it easy for us to set up our > apps this way. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Using models with plugins in CakePHP 1.2
I'd have to agree with some folks here---it'd be great if plugins could "plugin" into the existing application and have access to the main app's models, etc. Perhaps plugins could be split into two types? One of the reasons Wordpress is so popular is its plugin system (which tap into the larger app). It'd be nice if CakePHP made it easy for us to set up our apps this way. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Using models with plugins in CakePHP 1.2
I was trying to do something earlier with plugins in 1.1 and everything seemed to work fine until the larger application wanted to access the plugin, then things went downhill. I made a plugin that controlled all the authentication, registering, logging in and out of users. The idea for this was that, why do I have to copy the same models, views and controllers between every app when I can just drop it in the plugin dir and have app_controller load it? To me, that's my idea of a plugin but, I wanted the app to be able to access some of the data or functionality and was told that it wouldn't work like that. I could have used an rA() call but, at that time, the slow down for me was unbearable. Dunno if it was ever fixed but, just as a warning. Look carefully at your plugin, what it does, how it interacts with the larger app. For now, if your plugin requires anything from your app or you app wants to hook into your plugin, then it may be wise to forgo the plugin altogether. (At least until plugins work the way I envision them! =D). On Nov 15, 1:38 am, Gwoo <[EMAIL PROTECTED]> wrote: > Quoting the intro of the plugins section of the manual, "CakePHP > allows you to set up a combination of controllers, models, and views > and release them as a packaged application plugin that others can use > in their CakePHP applications...Package it as a CakePHP plugin so you > can pop it into other applications." > > This pretty much sums up the original intent of a plugin as a > portable, distributed, mini app. As such, Plugins would have no > knowledge of the main application, so they can be easy added to an > existing application without requiring any extra configuration or the > addition of other classes. Essentially, what you are talking about > would be creating dependencies that were not intended. > > Correct me if I am wrong, but it seems some are using plugins to > organize parts of a larger application. To me, you are on a slippery > slope here to basically negating the whole benefit of a plugin and > just making it more work on yourself. Using the config/bootstrap.php > to organize your MVC requires a lot less code and should yield the > same benefits. > > That said, there are some changes in the works that may allow this > functionality. So time will tell, but at least you know why it works > the way it does right now. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Using models with plugins in CakePHP 1.2
This is all about you isnt it? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Using models with plugins in CakePHP 1.2
On 11/15/07, Gwoo <[EMAIL PROTECTED]> wrote: > Correct me if I am wrong, but it seems some are using plugins to > organize parts of a larger application. Not exactly - I am trying to add more functionality to an existing app. Basically trying to provide addon/plugin features to an core app - Cheesecake 2 What I am trying to solve is essentially non techie users wanting to plugin functionality - asking end users to edit code or for that matter asking them to upload parts in several different directories does not work very well Plugin offers a simple upload in single folder - add to it a dashboard to install/uninstall activate/deactivate these in your core app and you are rolling great. > To me, you are on a slippery > slope here to basically negating the whole benefit of a plugin Again no - a major benefit of a pulgin for me is allowing users to choose features and prevent bloat in core of the app >and > just making it more work on yourself. Using the config/bootstrap.php > to organize your MVC requires a lot less code and should yield the > same benefits. For a end developer/commercial product perhaps yes All that said I guess a simple combination of ClassRegistry::getObject and loadModel will still work from within a plugin controller ;) Cheers Tarique -- = Cheesecake-Photoblog: http://cheesecake-photoblog.org PHP for E-Biz: http://sanisoft.com = --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Using models with plugins in CakePHP 1.2
Quoting the intro of the plugins section of the manual, "CakePHP allows you to set up a combination of controllers, models, and views and release them as a packaged application plugin that others can use in their CakePHP applications...Package it as a CakePHP plugin so you can pop it into other applications." This pretty much sums up the original intent of a plugin as a portable, distributed, mini app. As such, Plugins would have no knowledge of the main application, so they can be easy added to an existing application without requiring any extra configuration or the addition of other classes. Essentially, what you are talking about would be creating dependencies that were not intended. Correct me if I am wrong, but it seems some are using plugins to organize parts of a larger application. To me, you are on a slippery slope here to basically negating the whole benefit of a plugin and just making it more work on yourself. Using the config/bootstrap.php to organize your MVC requires a lot less code and should yield the same benefits. That said, there are some changes in the works that may allow this functionality. So time will tell, but at least you know why it works the way it does right now. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Using models with plugins in CakePHP 1.2
On 11/9/07, Aaron Shafovaloff <[EMAIL PROTECTED]> wrote: > > I guess it makes sense for me that plugins could inherit models. > Plugins plug into the existing applications, i.e. have connection to > beyond the simple routing. I agree whole heartedly with the above. Plugins are meant for existing apps, they can be app specific if the plugin developer wants to @Gwoo - I am stupid and I can't understand why but please bear with me and elaborate why Thanks in advance Tarique -- = Cheesecake-Photoblog: http://cheesecake-photoblog.org PHP for E-Biz: http://sanisoft.com = --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Using models with plugins in CakePHP 1.2
I guess it makes sense for me that plugins could inherit models. Plugins plug into the existing applications, i.e. have connection to beyond the simple routing. On Nov 8, 11:21 am, Gwoo <[EMAIL PROTECTED]> wrote: > Plugins should not access models from application. If you think about > "plugin" for a second you can understand why. There are other ways to > organize your models, see /app/config/bootstrap.php --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Using models with plugins in CakePHP 1.2
Plugins should not access models from application. If you think about "plugin" for a second you can understand why. There are other ways to organize your models, see /app/config/bootstrap.php --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Using models with plugins in CakePHP 1.2
Thanks, but what if it's part of the main app? That's my particular problem. On Nov 7, 11:59 pm, rtconner <[EMAIL PROTECTED]> wrote: > I think you have to do.. > > $uses = array('Pluginname.Modelname'); > > On Nov 7, 10:54 pm, Aaron Shafovaloff <[EMAIL PROTECTED]> wrote: > > > I have a plugin which has two models of its own. I've followed the > > directions to creating a plugin to the T. > > > In the plugin's own app_controller file I have the following: > > > class PluginNameAppController extends AppController ... > > > This creates a problem. The main AppController file "uses" some > > models, like User. But I get a missing model error because it attempts > > to load models used by AppController in the plugin's models > > subdirectory. The User model is in the main models directory, though. > > > Any thoughts? Is this just a deficiency of CakePHP 1.2 I'll have to > > live with? Why can't I use models in the main app models directory? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Using models with plugins in CakePHP 1.2
I think you have to do.. $uses = array('Pluginname.Modelname'); On Nov 7, 10:54 pm, Aaron Shafovaloff <[EMAIL PROTECTED]> wrote: > I have a plugin which has two models of its own. I've followed the > directions to creating a plugin to the T. > > In the plugin's own app_controller file I have the following: > > class PluginNameAppController extends AppController ... > > This creates a problem. The main AppController file "uses" some > models, like User. But I get a missing model error because it attempts > to load models used by AppController in the plugin's models > subdirectory. The User model is in the main models directory, though. > > Any thoughts? Is this just a deficiency of CakePHP 1.2 I'll have to > live with? Why can't I use models in the main app models directory? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Using models with plugins in CakePHP 1.2
I have a plugin which has two models of its own. I've followed the directions to creating a plugin to the T. In the plugin's own app_controller file I have the following: class PluginNameAppController extends AppController ... This creates a problem. The main AppController file "uses" some models, like User. But I get a missing model error because it attempts to load models used by AppController in the plugin's models subdirectory. The User model is in the main models directory, though. Any thoughts? Is this just a deficiency of CakePHP 1.2 I'll have to live with? Why can't I use models in the main app models directory? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---