Example #1
0
 /**
  * Registers autoloader method for Elastica classes
  * 
  * @param string $module_path
  * 
  * @return void
  */
 public static function register_autoloader($module_path)
 {
     // get path to Elastica's files
     self::$vendor_class_root = $module_path . "/vendor/Elastica/lib/";
     // check that path exists
     if (!file_exists(self::$vendor_class_root)) {
         throw new Exception(sprintf("Elastica path %s not found", self::$vendor_class_root));
     }
     // register autoloader
     spl_autoload_register('Kohana_Elastica::autoload');
 }
Example #2
0
<?php

// get path to module
$module_path = realpath(dirname(__FILE__));
// register autoloader with module path
Kohana_Elastica::register_autoloader(realpath(dirname(__FILE__)));