Auto loading of admin helpers broken in 3.7?

42 views
Skip to first unread message

Søren Beck Jensen

unread,
May 9, 2017, 4:26:51 AM5/9/17
to joomla-de...@googlegroups.com
Hello,

We have discovered an issue over at Component Creator and I thought I better run it by the list as I am not sure if people are aware of it already or even if it is considered a real issue.

Since 3.7 the auto loader is strict and does not allow loading of two classes with the same name. This presents a problem with components that had helper files in both the front end and the admin.

ExampleHelperExample and ExampleHelperExample

To solve this, most of the core components are now not using the auto loader and braking the naming convention of classes by naming their admin helpers "ExampleHelper" and manually loading them with JLoader::register(‘ExampleHelper’, ‘<path_to_the_file>’);

Surely this can not be the "correct" approach?

Is this issue known/discussed?

Thanks,

Soren

---

Soren Beck Jensen

Joomla Volunteer
- Department Coordinator, Legal and Finance 
- OSM board member
- Joomla Capitals Committee 
- Joomla Resources Directory Team

CEO and Founder

Cook Self Service

unread,
May 9, 2017, 7:28:04 AM5/9/17
to Joomla! General Development
To my opinion, helpers have nothing to do in the front-end. Whatever it is Joomla convention or not.

Simply merge your two helpers classes into the back-end, then remove the front helpers and you’re done with your issue.

Helpers are always STATIC calls, so there is no need for repeating the code. That’s generally the idea.
Remember the DRY convention (Don’t Repeat Yourself)

A good convention is to separate the helpers by types of works (HTML / Dates / Files / Enumerations / Forms), so you can optimize and load only the strict necessary.
In case you really want a helper only for the front-end, you can maybe create a HelperFrontend, but I don't know why to do such thing.

Hope it helps.
Jocelyn.


- - - 8< - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Jocelyn HUARD
Cook Self Service - Joomla application builder
con...@j-cook.pro
www.j-cook.pro
- - - - - - - - - - - - - - - - - - - - - - - - >8 - - - - - - - - - -
Reply all
Reply to author
Forward
0 new messages