diff --git a/src/Bootstrap.php b/src/Bootstrap.php index e3c9e1c2..bfa40d07 100644 --- a/src/Bootstrap.php +++ b/src/Bootstrap.php @@ -232,6 +232,15 @@ public function boot($options = array()) { require_once $civicrm_root . '/CRM/Core/ClassLoader.php'; \CRM_Core_ClassLoader::singleton()->register(); + // Include the UF's autoloader. Should this be tuned based on UF type? + if (!isset($cmsBasePath)) { + list (, $cmsBasePath) = $this->findCmsRoot($this->getSearchDir()); + } + $cmsAutoloader = dirname($cmsBasePath) . DIRECTORY_SEPARATOR . 'vendor/autoload.php'; + if (file_exists($cmsAutoloader)) { + require_once $cmsAutoloader; + } + if (!empty($options['prefetch'])) { $this->writeln("Call core bootstrap", OutputInterface::VERBOSITY_VERBOSE); // I'm not sure why this is called explicitly during bootstrap @@ -286,6 +295,13 @@ public function generate() { $code[] = 'require_once $GLOBALS["civicrm_root"] . "/CRM/Core/ClassLoader.php";'; $code[] = '\CRM_Core_ClassLoader::singleton()->register();'; + // Include the UF's autoloader. Should this be tuned based on UF type? + list (, $cmsBasePath) = $this->findCmsRoot($this->getSearchDir()); + $cmsAutoloader = dirname($cmsBasePath) . DIRECTORY_SEPARATOR . 'vendor/autoload.php'; + if (file_exists($cmsAutoloader)) { + $code[] = sprintf('require_once %s;', var_export($cmsAutoloader, 1)); + } + return implode("\n", $code); }