Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
generate model files in Silex
function help()
printf("generate_model schema environment\n");
printf("\nschema is the database schema you want to scan.\n");
printf("environment set the database connection that will be used (default: dev).\n");
if (PHP_SAPI !== 'cli') {
throw new \Exception("This is a CLI tool that therefor needs to be launched in a terminal.");
if (count($argv) < 2 or ! preg_match("/^[a-z0-9_]+$/", $argv[1])) {
$env = count($argv) >= 3 ? $argv[2] : 'dev';
define('ENV', $env);
$app = require __DIR__."/../src/bootstrap.php";
$scan = new Pomm\Tools\ScanSchemaTool(array(
'schema' => $argv[1],
'database' => $app['pomm']->getDatabase(),
'prefix_dir' => __DIR__."/../src",
foreach ( $scan->getOutputStack() as $line )
printf("%s\n", $line);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment