diff --git a/tools/modelGenerator.php b/tools/modelGenerator.php index 3eb86a7..f429325 100755 --- a/tools/modelGenerator.php +++ b/tools/modelGenerator.php @@ -35,10 +35,14 @@ class modelGenerator { $getopts = new \getopts (); $getopts->add ("Help", "?h", "help", "Help of the software"); - $getopts->add ("DSN", "", "dsn:", "DSN - Data Source Name", "dsn"); - $getopts->add ("Output", "o:", "output:", "Output directory", "dir"); + $getopts->add ("DSN", "", "dsn:", "DSN - Data Source Name\n". + " Exemple : --dsn \"mysql:dbname=DBNAME\"", + "dsn"); + $getopts->add ("Output", "o:", "output:", + "Output directory, ./models by default", "dir"); $getopts->add ("Namespace", "n:", "namespace:", - "The namespace (if '', not added)", "namespaceName"); + "The namespace (if '', not added), models by default", + "namespaceName"); $getopts->add ("Username", "u:", "username:", "Username to connect", "username"); $getopts->add ("Password", "p:", "password:", "Password to connect", @@ -64,9 +68,17 @@ class modelGenerator $this->dsn = $dsn; $this->modelsDir = $modelsDir; $this->namespaceName = $getopts->get ("Namespace"); - $this->db = new \dblayeroo ($dsn, - $getopts->get ("Username"), - $getopts->get ("Password")); + try + { + $this->db = new \dblayeroo ($dsn, + $getopts->get ("Username"), + $getopts->get ("Password")); + } + catch (\Exception $e) + { + file_put_contents ("php://stderr", $e->getMessage ()."\n"); + exit (3); + } } /** List all the existing tables in the database