@@ -46,6 +46,7 @@ public function getPossibleParams()
4646 return [
4747 'name=s ' => 'Table name ' ,
4848 'schema=s ' => 'Name of the schema [optional] ' ,
49+ 'config=s ' => 'Configuration file [optional] ' ,
4950 'namespace=s ' => "Model's namespace [optional] " ,
5051 'get-set ' => 'Attributes will be protected and have setters/getters [optional] ' ,
5152 'extends=s ' => 'Model extends the class name supplied [optional] ' ,
@@ -74,10 +75,32 @@ public function run(array $parameters)
7475 $ name = $ this ->getOption (['name ' , 1 ]);
7576 $ className = Utils::camelize (isset ($ parameters [1 ]) ? $ parameters [1 ] : $ name , '_- ' );
7677
78+ if ($ this ->isReceivedOption ('config ' )) {
79+ if (false == $ this ->path ->isAbsolutePath ($ this ->getOption ('config ' ))) {
80+ $ configPath = $ this ->path ->getRootPath () . $ this ->getOption ('config ' );
81+ } else {
82+ $ configPath = $ this ->getOption ('config ' );
83+ }
84+
85+ if (preg_match ('/.*(:?\.ini)(?:\s)?$/i ' , $ configPath )) {
86+ $ config = new ConfigIni ($ configPath );
87+ } else {
88+ $ config = include $ configPath ;
89+
90+ if (is_array ($ config )) {
91+ $ config = new Config ($ config );
92+ }
93+ }
94+
95+ } else {
96+ $ config = $ this ->path ->getConfig ();
97+ }
98+
7799 $ modelBuilder = new ModelBuilder (
78100 [
79101 'name ' => $ name ,
80102 'schema ' => $ this ->getOption ('schema ' ),
103+ 'config ' => $ config ,
81104 'className ' => $ className ,
82105 'fileName ' => Text::uncamelize ($ className ),
83106 'genSettersGetters ' => $ this ->isReceivedOption ('get-set ' ),
0 commit comments