AnsweredAssumed Answered

How to autoload custom helpers or libraries?

Question asked by EvilPeri EvilPeri on Dec 3, 2014
Latest reply on Dec 12, 2014 by EvilPeri EvilPeri
Hi Guys,

So i was doing a couple of customization on both custom and OOTB modules and it seems that i've been adding the same block of code again and again to instantiate my helper.

I'd do something like:

private function setHelper()
    $filePath = '/file/path/goes/here';
    if ((empty($this->helper) || !($this->helper instanceof HelperClass)) && SugarAutoLoader::fileExists($filePath)) {
        return $this->helper = new HelperClass();
    return false;

been doing the same block of code to multiple files and i was just wondering if maybe there is a better way of autoloading my custom helper files or even libraries?

I've tried reading this article about sugarcrm's autoloading but it got me even more confused.
If anyone out there has an idea or a better solution please do share.