Re: Cake 3.0 - Convenient way to retrieve if the current Table/Behavior is part of a plugin or not

2015-02-02 Thread Ernesto
Because i have some tables with the same name (eg. "orders"), in different plugins. Il giorno lunedì 2 febbraio 2015 23:14:47 UTC+1, José Lorenzo ha scritto: > > Why do you need to know if something is in a plugin, btw? > > On Monday, February 2, 2015 at 10:12:34 AM UTC-4:30, Ernesto wrote: >> >>

Re: Cake 3.0 - Convenient way to retrieve if the current Table/Behavior is part of a plugin or not

2015-02-02 Thread José Lorenzo
Why do you need to know if something is in a plugin, btw? On Monday, February 2, 2015 at 10:12:34 AM UTC-4:30, Ernesto wrote: > > that "probably" gives me chills :P > > what do you think about this solution? > > //in my table class > public function plugin() > { > foreach (Configure::read('App.pat

Re: Cake 3.0 - Convenient way to retrieve if the current Table/Behavior is part of a plugin or not

2015-02-02 Thread Ernesto
that "probably" gives me chills :P what do you think about this solution? //in my table class public function plugin() { foreach (Configure::read('App.paths.plugins') as $pluginPath) { if (is_numeric(strpos(strtolower(__FILE__), strtolower($pluginPath { return string_between(strtolower(__FILE

Re: Cake 3.0 - Convenient way to retrieve if the current Table/Behavior is part of a plugin or not

2015-02-02 Thread Ernesto
that "probably" gives me chills :P what do you think about this solution? //in my table class public function plugin () { foreach (Configure::read('App.paths.plugins') as $pluginPath) { return string_between(strtolower(__FILE__), strtolower($pluginPath), DS); } } //somewhere function string_betw

Re: Cake 3.0 - Convenient way to retrieve if the current Table/Behavior is part of a plugin or not

2015-01-30 Thread José Lorenzo
Check the namespace of the class: list($namespace, $class) = namespaceSplit(get_class($table)); if ($namespace !== 'App\Model\Table') // Probably a plugin :) On Friday, January 30, 2015 at 4:10:31 PM UTC+1, Ernesto wrote: > > Hi all > > is there a convenient way to retrieve if the current Table

Cake 3.0 - Convenient way to retrieve if the current Table/Behavior is part of a plugin or not

2015-01-30 Thread Ernesto
Hi all is there a convenient way to retrieve if the current Table/Behavior is part of a plugin or not? in Controllers and Helpers i can inspect the request object and get it done. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You re