コード例 #1
0
ファイル: Entity.php プロジェクト: las93/venus3
 /**
  * run the batch to create entity
  * @tutorial bin/console scaffolding
  *
  * @access public
  * @param  array $aOptions options of script
  * @return void
  */
 public function runScaffolding(array $aOptions = array())
 {
     if (!isset($aOptions['p'])) {
         $aOptions['p'] = 'Batch';
     }
     if (!isset($aOptions['b'])) {
         $aOptions['b'] = json_encode(Config::get('Db', $aOptions['p']));
     }
     $aOptions['g'] = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . $aOptions['p'] . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . 'Entity' . DIRECTORY_SEPARATOR;
     $aOptions['h'] = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . $aOptions['p'] . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . 'Model' . DIRECTORY_SEPARATOR;
     if (!defined('ENTITY_NAMESPACE')) {
         define('ENTITY_NAMESPACE', '\\Venus\\src\\' . $aOptions['p'] . '\\Entity');
     }
     if (!defined('MODEL_NAMESPACE')) {
         define('MODEL_NAMESPACE', '\\Venus\\src\\' . $aOptions['p'] . '\\Model');
     }
     $oBatch = new BatchEntity();
     $oBatch->runScaffolding($aOptions);
 }
コード例 #2
0
ファイル: index.php プロジェクト: las93/attila
            $sOptionValue = $aArguments[1];
        } else {
            $sOptionValue = '';
        }
        if (isset(Entity::$aOptionsBatch[$sOptionName]) && Entity::$aOptionsBatch[$sOptionName] === false) {
            $aOptions[$sOptionName] = true;
            array_shift($aArguments);
        } else {
            if (isset(Entity::$aOptionsBatch[$sOptionName]) && Entity::$aOptionsBatch[$sOptionName] === 'string') {
                $aOptions[$sOptionName] = $sOptionValue;
                array_shift($aArguments);
                array_shift($aArguments);
            } else {
                array_shift($aArguments);
            }
        }
    } else {
        array_shift($aArguments);
    }
}
if ($sBatchName == 'scaffolding:run') {
    $oBatch = new Entity();
    $oBatch->runScaffolding($aOptions);
} else {
    if ($sBatchName == 'db:init') {
        $oBatch = new Operation();
        $oBatch->createDb($aOptions);
    } else {
        new \Exception("Error: batch doesn\\'t exist");
    }
}