Ejemplo n.º 1
0
 /**
  * Get an instance of a class based on a class identifier
  *
  * @param KObjectIdentifier $identifier
  * @param bool              $fallback   Use fallbacks when locating the class. Default is TRUE.
  * @return  string  Return the identifier class or FALSE on failure.
  */
 protected function _locate(KObjectIdentifier $identifier, $fallback = true)
 {
     $class = $this->__registry->getClass($identifier);
     //If the class is FALSE we have tried to locate it already, do not locate it again.
     if ($class !== false) {
         //Set loader basepath if we are locating inside an application
         if ($this->isRegistered('object.bootstrapper')) {
             if ($path = $this->getObject('object.bootstrapper')->getApplicationPath($identifier->domain)) {
                 $this->getClassLoader()->setBasePath($path);
             }
         }
         if (empty($class)) {
             $class = $this->_locators[$identifier->getType()]->locate($identifier, $fallback);
             //If we are falling back set the class in the registry
             if ($fallback) {
                 if (!$this->__registry->get($identifier) instanceof KObjectInterface) {
                     $this->__registry->setClass($identifier, $class);
                 }
             }
         }
     }
     return $class;
 }
Ejemplo n.º 2
0
 /**
  * Clears APC cache
  *
  * @return $this
  */
 public function clear()
 {
     // Clear user cache
     apc_clear_cache('user');
     return parent::clear();
 }