Re: CakePHP 3.0 Plugin - Where to put a « global » function for multiple helpers

2015-07-27 Thread Mikaël Capelle
Thanks! Exactly what I was looking for. On Monday, July 27, 2015 at 2:29:31 PM UTC+2, Florian Krämer wrote: > > Then use a trait . > > On Monday, July 27, 2015 at 11:32:54 AM UTC+2, Mikaël Capelle wrote: >> >> I cannot do that without multiple inh

Re: CakePHP 3.0 Plugin - Where to put a « global » function for multiple helpers

2015-07-27 Thread Florian Krämer
Then use a trait . On Monday, July 27, 2015 at 11:32:54 AM UTC+2, Mikaël Capelle wrote: > > I cannot do that without multiple inheritance (which, as far as I know, > does not exist in php) because as I stated in my post, all my helpers does > no

Re: CakePHP 3.0 Plugin - Where to put a « global » function for multiple helpers

2015-07-27 Thread Mikaël Capelle
I cannot do that without multiple inheritance (which, as far as I know, does not exist in php) because as I stated in my post, all my helpers does not inherit a standard CakePHP helpers, for instance I have: class MyHTMLHelper extends HTMLHelper { ... } class MyFormHelper extends FormHelper { ..

Re: CakePHP 3.0 Plugin - Where to put a « global » function for multiple helpers

2015-07-27 Thread Florian Krämer
Simple OOP? MySpecialHelper extends MyBaseHelper {...} MyOtherSpecialHelper extends MyBaseHelper {...} And MyBaseHelper implementds addClass(). On Friday, July 24, 2015 at 10:23:43 AM UTC+2, Mikaël Capelle wrote: > > Hi everyone, > > I am writing a CakePHP 3.0 plugins, and I have multiple help

CakePHP 3.0 Plugin - Where to put a « global » function for multiple helpers

2015-07-24 Thread Mikaël Capelle
Hi everyone, I am writing a CakePHP 3.0 plugins, and I have multiple helpers (inheriting from either HTMLHelper, FormHelper, PaginatorHelper, etc.). In each of these new helpers, I have a function *addClass* (copy/paste from helper to helper... ). I don't really like having duplicated code (5