GImport
Name | gImport |
---|---|
Class | GImport |
Location | /home/vhosts/app-manager.eu5.org/protected/extensions/GImport.php |
Author | Boris Serebrov |
Version | Not set |
Link | Not set |
GImport class implements recursive import of directories with caching.
Import is performed recursively for specified path alias. Classes found are cached, so the import process can be slow only first time. Default cache path is 'runtime/classes'. Usage example:
Import is performed recursively for specified path alias. Classes found are cached, so the import process can be slow only first time. Default cache path is 'runtime/classes'. Usage example:
$importer = new GImport; $importer->add('modules.myModule.*');This code will import all clasees from myModule module. GImport can also be configured as application component. Add following to application components config:
return array( ... 'preload' => array('log', 'import'), ... 'components' => array( 'import' => array( 'class'=>'GImport', 'import' => array( // add directories to import and // put 'import' component to preload to trigger import // on application initialization 'application.extensions.*', ), ),To import additional classes in runtime use following code:Yii::app()->import->add('modules.myModule.*');Class names and paths will be added to Yii::$classMap and available for autoload. Import performed only once for each alias. Class cache is saved into file in the (by default) runtime/classes directory. During development clean 'runtime/classes' after changing files structure or set '$cacheEnabled' property to false to disable file cache.
Options
Displaying 1-5 of 5 results.
Name | Value | Description | Type |
---|---|---|---|
import | array() | Array with initial imports. list of aliases to import | array |
scanOptions | array ( 'fileTypes' => array ( 'php', ), 'exclude' => array ( '.svn', '.git', '/assets', '/commands', '/messages', '/templates', 'views', 'view.php', ), ) | Options for {@CFileHelper} when searching for class files. | array |
cacheDirAlias | 'application.runtime.classes' | Path alias of the folder for cached import arrays | string |
cacheEnabled | true | Whether to enable caching. whether to enable caching, default - true. | boolean |
behaviors | array() | The behaviors that should be attached to this component. The behaviors will be attached to the component when {@link init} is called. Please refer to {@link CModel::behaviors} on how to specify the value of this property. | array |