* ./doctrine original-doctrine-command -module path-to-your-module */ // Module name argument $moduleNameIndex = array_search('-module', $argv); if ($moduleNameIndex !== false) { // Module argument is set // Check & Access Module Name $moduleName = isset($argv[$moduleNameIndex + 1]) ? $argv[$moduleNameIndex + 1] : null; if (!empty($moduleName)) { // Module name is not empty and already exist if (!is_dir(MODULES_PATH . "/" . $moduleName)) { die("** Module path not found! **" . PHP_EOL); } // Fiter SeperatorToCamelCase Setup $filter = new Zend_Filter_Word_UnderscoreToCamelCase(); $camelCaseModuleName = $filter->setSeparator('-')->filter($moduleName); // Replacement Mapping, String Replace and Apply Filter $mapping = array('find' => array(APPLICATION_PATH, DEVELOPER_PATH, "Model_"), 'replace' => array(MODULES_PATH . "/" . $moduleName, MODULES_PATH . "/" . $moduleName . "/" . $paths['dev'], $camelCaseModuleName . "_Model_")); // Apply New Cli Settings $doctrineCliCfgs = str_replace($mapping['find'], $mapping['replace'], array_merge($doctrineCliCfgs, array('generate_models_options' => str_replace($mapping['find'], $mapping['replace'], $doctrineCliCfgs['generate_models_options'])))); echo "** '" . $moduleName . "' module is being processed... **" . PHP_EOL; } else { //KBBTODO: Add console code color die("** Please type your module path! **" . PHP_EOL . "~\$>./doctrine original-doctrine-command -module path-to-your-module" . PHP_EOL); } } // ----------------------------------------------------------------------------- // Cli Initialize $cli = new Doctrine_Cli($doctrineCliCfgs); $cli->run($argv); // -----------------------------------------------------------------------------
/** * Metodo para tranformar as variaveis vindas do bd em variaveis PHP * id_usuario => idUsuario * * @param string $value */ protected function _underToCamel($value) { $filter = new Zend_Filter_Word_UnderscoreToCamelCase(); $filter->setSeparator('_'); return lcfirst($filter->filter($value)); }