Monday, October 28, 2013

Re: Defining Plugin

What options did you end up using?

On Tuesday, October 29, 2013, Ed Propsner wrote:
I was able to work everything out using $this->paginator options(). I appreciate the help :)


On Mon, Oct 28, 2013 at 2:17 AM, Ed Propsner <crotchfrog@gmail.com> wrote:
You're absolutely right, I was definitely confusing the two. I suppose that I'm so used to referencing the plugin as camel-case everywhere else within the app and since functions are camel-case and they are referenced as such in the URL, it wasn't a far stretch to make the mistake of constructing my links with 'plugin' => 'SomePlugin'. I definitely learned my lesson on that one. I have everything fixed in the app except for pagination. It loads the first :page fine but still assumes on the following :pages the plugin should be loaded as camel-case instead of underscore. Is there something I missed when changing everything over, or is there some place I should let Cake know that those pages belong in some_plugin? I noticed that when the error is thrown the error log shows the plugin as null.  



On Sun, Oct 27, 2013 at 6:56 PM, euromark <dereuromark@gmail.com> wrote:
Yes, I guess you have been creating non-conventional links so far. Mainly because you are confusing framework internal naming schemes with URL naming scheme
The latter defines everything underscore_lowercased, even the plugin.
The first refers mainly to classes, which will always be named CamelCased.

You need to understand the difference in order to not write faulty code - which at some point can blow up (as it then did).


Am Samstag, 26. Oktober 2013 04:43:11 UTC+2 schrieb CrotchFrog:
I've noticed recently some strange behavior when it comes to naming conventions and Plugins.  

For example if I create a link somewhere within a plugin ie. $this->Html->link('Some Link', array('controller' => 'controller', 'action' => 'action')); 
Following the link would land you on the page app/plugin/controller/action unless a location is specified outside of the current plugin and controller. 

Links created this way and that have been working since they were created sometimes out of the blue throw an error along the lines of SomePluginController cannot be found. 
This is strange because the link has always worked in the past. When these links create an error I have to re-create the link and specify the plugin $this->Html->link('controller' => 'controller', 'action' => 'action', 'plugin' => 'some_plugin')
I have to use an underscore in the plugin name, using camel case results in the same error. 

It's possible that some, but not all, of the links were created only specifying the action and not the controller. With this being the case I could sort of understand the resulting error but not when I have specified both the controller and the action.

I created all of my custom routes with the plugin as camel case, it just seems to be links and redirects that display this behavior.  

I assumed that with sticking to naming conventions I could write it as SomePlugin or some_plugin and either one would be fine. 

Have I been creating my links incorrectly this entire time? 

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to a topic in the Google Groups "CakePHP" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/cake-php/zDwuUhlVGzE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send em

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: