/**
  * Creates a component instance.
  * This method will create a component instance.
  * If the $id parameter is supplied, the component will have its ID set to that
  * after the creation.
  * @param string the component type
  * @param string the component ID
  * @return TComponent the component instance
  * @throw TComponentNotDefinedException
  */
 public function createComponent($type, $id = '')
 {
     // create component from cache if possible
     $component = $this->cacheManager->cloneComponent($type);
     if (is_null($component)) {
         if (pradoImportClass($type)) {
             $component = new $type();
         } else {
             throw new TComponentNotDefinedException($type);
         }
         // cache the component if needed (to facilitate future creations)
         $this->cacheManager->cacheComponent($component);
     }
     if (!empty($id)) {
         $component->setID($id);
     }
     $component->initProperties();
     return $component;
 }
示例#2
0
 function __autoload($className)
 {
     pradoImportClass($className);
 }