コード例 #1
0
ファイル: Entity.php プロジェクト: srinathweb/MTool
 /**
  * Create entity
  *
  * @param Mtool_Codegen_Entity_Abstract $entity
  * @param string $name
  * @param string $targetModule in format of companyname/modulename
  * @param string $entityPath in format of mymodule/model_path
  */
 protected function _createEntity($entity, $name, $targetModule = null, $entityPath = null)
 {
     if ($targetModule == null) {
         $targetModule = $this->_ask('Enter the target module (in format of Mycompany/Mymodule)');
     }
     if ($entityPath == null) {
         $entityPath = $this->_ask("Enter the {$name} path (in format of mymodule/{$name}_path)");
     }
     list($companyName, $moduleName) = explode('/', $targetModule);
     $module = new Mtool_Codegen_Entity_Module(getcwd(), $moduleName, $companyName, $this->_getConfig());
     list($namespace, $entityName) = explode('/', $entityPath);
     $entity->create($namespace, $entityName, $module);
     $this->_answer('Done');
 }