@@ -67,7 +67,7 @@ |
||
67 | 67 | 'database' => true , |
68 | 68 | 'host' => true , |
69 | 69 | 'username' => true , |
70 | - // 'password' => true , |
|
70 | + // 'password' => true , |
|
71 | 71 | 'path' => true |
72 | 72 | ); |
73 | 73 |
@@ -11,78 +11,78 @@ discard block |
||
11 | 11 | abstract class AbstractAdapter |
12 | 12 | { |
13 | 13 | |
14 | - protected $arrConfig = array ( |
|
14 | + protected $arrConfig = array( |
|
15 | 15 | ############################# DATABASE |
16 | 16 | //Driver do banco de dados |
17 | - 'driver' => null , |
|
17 | + 'driver' => null, |
|
18 | 18 | //Nome do banco de dados |
19 | - 'database' => null , |
|
19 | + 'database' => null, |
|
20 | 20 | //Host do banco |
21 | - 'host' => 'localhost' , |
|
21 | + 'host' => 'localhost', |
|
22 | 22 | //Port do banco |
23 | - 'port' => '' , |
|
23 | + 'port' => '', |
|
24 | 24 | //usuario do banco |
25 | - 'username' => null , |
|
25 | + 'username' => null, |
|
26 | 26 | //senha do banco |
27 | - 'password' => null , |
|
27 | + 'password' => null, |
|
28 | 28 | // lista de schemas do banco de dados |
29 | - 'schema' => array () , |
|
29 | + 'schema' => array(), |
|
30 | 30 | |
31 | - 'socket' => null , |
|
31 | + 'socket' => null, |
|
32 | 32 | |
33 | 33 | ########################### DOCS |
34 | 34 | // autor que gerou o script |
35 | - 'author' => "Pedro" , |
|
36 | - 'license' => "New BSD License" , |
|
37 | - 'copyright' => "DAO Generator-Pedro151" , |
|
38 | - 'link' => 'https://github.com/pedro151' , |
|
35 | + 'author' => "Pedro", |
|
36 | + 'license' => "New BSD License", |
|
37 | + 'copyright' => "DAO Generator-Pedro151", |
|
38 | + 'link' => 'https://github.com/pedro151', |
|
39 | 39 | // data que foi gerado o script |
40 | - 'last_modify' => null , |
|
40 | + 'last_modify' => null, |
|
41 | 41 | |
42 | 42 | ########################## Ambiente/Arquivos |
43 | 43 | |
44 | 44 | // Nome do framework para o adapter |
45 | - 'framework' => null , |
|
45 | + 'framework' => null, |
|
46 | 46 | // namespace das classes |
47 | - 'namespace' => "" , |
|
47 | + 'namespace' => "", |
|
48 | 48 | // caminho onde os arquivos devem ser criados |
49 | - 'path' => 'models' , |
|
49 | + 'path' => 'models', |
|
50 | 50 | // flag para gerar pasta com o nome do driver do banco de dados |
51 | - 'folder-database' => 0 , |
|
51 | + 'folder-database' => 0, |
|
52 | 52 | |
53 | 53 | ############################## Comandos adicionais |
54 | 54 | //flag para mostrar o status da execução ao termino do processo |
55 | - 'status' => false , |
|
55 | + 'status' => false, |
|
56 | 56 | // flags para criar todas as tabelas ou nao |
57 | - 'allTables' => true , |
|
57 | + 'allTables' => true, |
|
58 | 58 | //Lista de tabelas a serem ignoradas |
59 | - 'ignoreTable' => array () , |
|
59 | + 'ignoreTable' => array(), |
|
60 | 60 | ); |
61 | 61 | |
62 | 62 | /** |
63 | 63 | * @var string[] um array com todos os campos obrigatorios |
64 | 64 | */ |
65 | - protected $attRequered = array ( |
|
66 | - 'driver' => true , |
|
67 | - 'database' => true , |
|
68 | - 'host' => true , |
|
69 | - 'username' => true , |
|
65 | + protected $attRequered = array( |
|
66 | + 'driver' => true, |
|
67 | + 'database' => true, |
|
68 | + 'host' => true, |
|
69 | + 'username' => true, |
|
70 | 70 | // 'password' => true , |
71 | 71 | 'path' => true |
72 | 72 | ); |
73 | 73 | |
74 | - protected $arrFunc = array (); |
|
74 | + protected $arrFunc = array(); |
|
75 | 75 | |
76 | - private $framworkFiles = array (); |
|
76 | + private $framworkFiles = array(); |
|
77 | 77 | |
78 | 78 | /** |
79 | 79 | * verifica se todos valores obrigatorios tem valor |
80 | 80 | * |
81 | 81 | * @return bool |
82 | 82 | */ |
83 | - protected function checkConfig () |
|
83 | + protected function checkConfig() |
|
84 | 84 | { |
85 | - if ( array_diff_key ( $this->attRequered , array_filter ( $this->arrConfig ) ) ) |
|
85 | + if (array_diff_key($this->attRequered, array_filter($this->arrConfig))) |
|
86 | 86 | { |
87 | 87 | return false; |
88 | 88 | } |
@@ -95,47 +95,47 @@ discard block |
||
95 | 95 | * |
96 | 96 | * @return array |
97 | 97 | */ |
98 | - protected abstract function getParams (); |
|
98 | + protected abstract function getParams(); |
|
99 | 99 | |
100 | 100 | /** |
101 | 101 | * Popula as config do generater com as configuraçoes do framework |
102 | 102 | * |
103 | 103 | * @return mixed |
104 | 104 | */ |
105 | - protected abstract function parseFrameworkConfig (); |
|
105 | + protected abstract function parseFrameworkConfig(); |
|
106 | 106 | |
107 | 107 | /** |
108 | 108 | * @param \Classes\Db\DbTable|\Classes\Db\Constrant $table |
109 | 109 | * |
110 | 110 | * @return mixed |
111 | 111 | */ |
112 | - public abstract function createClassNamespace ( $table ); |
|
112 | + public abstract function createClassNamespace($table); |
|
113 | 113 | |
114 | 114 | /** |
115 | 115 | * Cria Instancias dos arquivos que devem ser gerados |
116 | 116 | * |
117 | 117 | * @return AbstractAdapter[] |
118 | 118 | */ |
119 | - public abstract function getMakeFileInstances (); |
|
119 | + public abstract function getMakeFileInstances(); |
|
120 | 120 | |
121 | - protected abstract function init (); |
|
121 | + protected abstract function init(); |
|
122 | 122 | |
123 | - public function __construct ( $array ) |
|
123 | + public function __construct($array) |
|
124 | 124 | { |
125 | - $array += array ( |
|
126 | - 'author' => ucfirst ( get_current_user () ) , |
|
127 | - 'last_modify' => date ( "d-m-Y H:i:s." ) |
|
125 | + $array += array( |
|
126 | + 'author' => ucfirst(get_current_user()), |
|
127 | + 'last_modify' => date("d-m-Y H:i:s.") |
|
128 | 128 | ); |
129 | 129 | |
130 | - $this->setFrameworkFiles ( $array ); |
|
131 | - $this->parseFrameworkConfig (); |
|
132 | - $this->setParams ( $this->getParams () ); |
|
133 | - $this->setParams ( $array ); |
|
134 | - $this->init (); |
|
135 | - if ( ! $this->isValid () ) |
|
130 | + $this->setFrameworkFiles($array); |
|
131 | + $this->parseFrameworkConfig(); |
|
132 | + $this->setParams($this->getParams()); |
|
133 | + $this->setParams($array); |
|
134 | + $this->init(); |
|
135 | + if ( ! $this->isValid()) |
|
136 | 136 | { |
137 | - $var = array_diff_key ( $this->attRequered , array_filter ( $this->arrConfig ) ); |
|
138 | - throw new Exception( $var ); |
|
137 | + $var = array_diff_key($this->attRequered, array_filter($this->arrConfig)); |
|
138 | + throw new Exception($var); |
|
139 | 139 | } |
140 | 140 | } |
141 | 141 | |
@@ -144,47 +144,47 @@ discard block |
||
144 | 144 | * |
145 | 145 | * @param $array |
146 | 146 | */ |
147 | - public function setFrameworkFiles ( $array ) |
|
147 | + public function setFrameworkFiles($array) |
|
148 | 148 | { |
149 | - $this->framworkFiles[ 'library' ] = isset( $array[ 'framework-path-library' ] ) |
|
150 | - ? $array[ 'framework-path-library' ] |
|
149 | + $this->framworkFiles['library'] = isset($array['framework-path-library']) |
|
150 | + ? $array['framework-path-library'] |
|
151 | 151 | : null; |
152 | 152 | |
153 | - $this->framworkFiles[ 'ini' ] = isset( $array[ 'framework-ini' ] ) |
|
154 | - ? $array[ 'framework-ini' ] |
|
153 | + $this->framworkFiles['ini'] = isset($array['framework-ini']) |
|
154 | + ? $array['framework-ini'] |
|
155 | 155 | : null; |
156 | 156 | |
157 | - $this->framworkFiles[ 'environment' ] = isset( $array[ 'environment' ] ) |
|
158 | - ? $array[ 'environment' ] |
|
157 | + $this->framworkFiles['environment'] = isset($array['environment']) |
|
158 | + ? $array['environment'] |
|
159 | 159 | : 'production'; |
160 | 160 | |
161 | 161 | } |
162 | 162 | |
163 | - protected function isValidFrameworkFiles () |
|
163 | + protected function isValidFrameworkFiles() |
|
164 | 164 | { |
165 | - if ( ! is_file ( $this->framworkFiles[ 'ini' ] ) ) |
|
165 | + if ( ! is_file($this->framworkFiles['ini'])) |
|
166 | 166 | { |
167 | 167 | return false; |
168 | 168 | } |
169 | 169 | |
170 | - if ( ! is_dir ( $this->framworkFiles[ 'library' ] ) ) |
|
170 | + if ( ! is_dir($this->framworkFiles['library'])) |
|
171 | 171 | { |
172 | 172 | return false; |
173 | 173 | } |
174 | 174 | |
175 | 175 | |
176 | - if ( ! isset ( $this->framworkFiles[ 'environment' ] ) |
|
177 | - or empty( $this->framworkFiles[ 'environment' ] ) |
|
176 | + if ( ! isset ($this->framworkFiles['environment']) |
|
177 | + or empty($this->framworkFiles['environment']) |
|
178 | 178 | ) |
179 | 179 | { |
180 | 180 | return false; |
181 | 181 | } |
182 | - set_include_path ( |
|
183 | - implode ( |
|
184 | - PATH_SEPARATOR , |
|
185 | - array ( |
|
186 | - realpath ( $this->framworkFiles[ 'library' ] ) , |
|
187 | - get_include_path () , |
|
182 | + set_include_path( |
|
183 | + implode( |
|
184 | + PATH_SEPARATOR, |
|
185 | + array( |
|
186 | + realpath($this->framworkFiles['library']), |
|
187 | + get_include_path(), |
|
188 | 188 | ) |
189 | 189 | ) |
190 | 190 | ); |
@@ -192,120 +192,120 @@ discard block |
||
192 | 192 | return true; |
193 | 193 | } |
194 | 194 | |
195 | - protected function getFrameworkIni () |
|
195 | + protected function getFrameworkIni() |
|
196 | 196 | { |
197 | - return $this->framworkFiles[ 'ini' ]; |
|
197 | + return $this->framworkFiles['ini']; |
|
198 | 198 | } |
199 | 199 | |
200 | - protected function getEnvironment () |
|
200 | + protected function getEnvironment() |
|
201 | 201 | { |
202 | - return $this->framworkFiles[ 'environment' ]; |
|
202 | + return $this->framworkFiles['environment']; |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | /** |
206 | 206 | * Popula as variaveis de acordo com o arquivo de configuração do seu framework |
207 | 207 | */ |
208 | - protected function isValid () |
|
208 | + protected function isValid() |
|
209 | 209 | { |
210 | - return $this->checkConfig (); |
|
210 | + return $this->checkConfig(); |
|
211 | 211 | } |
212 | 212 | |
213 | - private function setParams ( $array ) |
|
213 | + private function setParams($array) |
|
214 | 214 | { |
215 | - if ( count ( $array ) > 0 ) |
|
215 | + if (count($array) > 0) |
|
216 | 216 | { |
217 | - $this->arrConfig = array_filter ( $array ) + $this->arrConfig; |
|
217 | + $this->arrConfig = array_filter($array) + $this->arrConfig; |
|
218 | 218 | } |
219 | 219 | } |
220 | 220 | |
221 | 221 | /** |
222 | 222 | * @return string |
223 | 223 | */ |
224 | - public function getDatabase () |
|
224 | + public function getDatabase() |
|
225 | 225 | { |
226 | - return $this->arrConfig[ 'database' ]; |
|
226 | + return $this->arrConfig['database']; |
|
227 | 227 | } |
228 | 228 | |
229 | 229 | /** |
230 | 230 | * @return bool |
231 | 231 | */ |
232 | - public function hasSchemas () |
|
232 | + public function hasSchemas() |
|
233 | 233 | { |
234 | - return ! empty ( $this->arrConfig[ 'schema' ] ); |
|
234 | + return ! empty ($this->arrConfig['schema']); |
|
235 | 235 | } |
236 | 236 | |
237 | 237 | /** |
238 | 238 | * @return string[] |
239 | 239 | */ |
240 | - public function getSchemas () |
|
240 | + public function getSchemas() |
|
241 | 241 | { |
242 | - if ( is_string ( $this->arrConfig[ 'schema' ] ) ) |
|
242 | + if (is_string($this->arrConfig['schema'])) |
|
243 | 243 | { |
244 | - return array ( $this->arrConfig[ 'schema' ] ); |
|
244 | + return array($this->arrConfig['schema']); |
|
245 | 245 | } |
246 | 246 | |
247 | - return $this->arrConfig[ 'schema' ]; |
|
247 | + return $this->arrConfig['schema']; |
|
248 | 248 | } |
249 | 249 | |
250 | - public function setSchema ( $schema ) |
|
250 | + public function setSchema($schema) |
|
251 | 251 | { |
252 | - $this->arrConfig[ 'schema' ] = $schema; |
|
252 | + $this->arrConfig['schema'] = $schema; |
|
253 | 253 | } |
254 | 254 | |
255 | 255 | /** |
256 | 256 | * @return string |
257 | 257 | */ |
258 | - public function getHost () |
|
258 | + public function getHost() |
|
259 | 259 | { |
260 | - return $this->arrConfig[ 'host' ]; |
|
260 | + return $this->arrConfig['host']; |
|
261 | 261 | } |
262 | 262 | |
263 | 263 | /** |
264 | 264 | * @return int |
265 | 265 | */ |
266 | - public function getPort () |
|
266 | + public function getPort() |
|
267 | 267 | { |
268 | - return $this->arrConfig[ 'port' ]; |
|
268 | + return $this->arrConfig['port']; |
|
269 | 269 | } |
270 | 270 | |
271 | 271 | /** |
272 | 272 | * @return boolean |
273 | 273 | */ |
274 | - public function hasPort () |
|
274 | + public function hasPort() |
|
275 | 275 | { |
276 | - return ! empty( $this->arrConfig[ 'port' ] ); |
|
276 | + return ! empty($this->arrConfig['port']); |
|
277 | 277 | } |
278 | 278 | |
279 | 279 | /** |
280 | 280 | * @return string |
281 | 281 | */ |
282 | - public function getSocket () |
|
282 | + public function getSocket() |
|
283 | 283 | { |
284 | - return $this->arrConfig[ 'socket' ]; |
|
284 | + return $this->arrConfig['socket']; |
|
285 | 285 | } |
286 | 286 | |
287 | 287 | /** |
288 | 288 | * @return string |
289 | 289 | */ |
290 | - public function getUser () |
|
290 | + public function getUser() |
|
291 | 291 | { |
292 | - return $this->arrConfig[ 'username' ]; |
|
292 | + return $this->arrConfig['username']; |
|
293 | 293 | } |
294 | 294 | |
295 | 295 | /** |
296 | 296 | * @return string |
297 | 297 | */ |
298 | - public function getPassword () |
|
298 | + public function getPassword() |
|
299 | 299 | { |
300 | - return $this->arrConfig[ 'password' ]; |
|
300 | + return $this->arrConfig['password']; |
|
301 | 301 | } |
302 | 302 | |
303 | 303 | /** |
304 | 304 | * @return bool |
305 | 305 | */ |
306 | - public function isStatusEnabled () |
|
306 | + public function isStatusEnabled() |
|
307 | 307 | { |
308 | - return (bool) $this->arrConfig[ 'status' ]; |
|
308 | + return (bool) $this->arrConfig['status']; |
|
309 | 309 | } |
310 | 310 | |
311 | 311 | /** |
@@ -313,23 +313,23 @@ discard block |
||
313 | 313 | * |
314 | 314 | * @return string |
315 | 315 | */ |
316 | - public function __get ( $str ) |
|
316 | + public function __get($str) |
|
317 | 317 | { |
318 | - $arr = array ( |
|
319 | - 'namespace' , |
|
320 | - 'framework' , |
|
321 | - 'author' , |
|
322 | - 'license' , |
|
323 | - 'copyright' , |
|
324 | - 'link' , |
|
325 | - 'last_modify' , |
|
326 | - 'path' , |
|
318 | + $arr = array( |
|
319 | + 'namespace', |
|
320 | + 'framework', |
|
321 | + 'author', |
|
322 | + 'license', |
|
323 | + 'copyright', |
|
324 | + 'link', |
|
325 | + 'last_modify', |
|
326 | + 'path', |
|
327 | 327 | 'folder-database' |
328 | 328 | ); |
329 | 329 | |
330 | - if ( in_array ( $str , $arr ) ) |
|
330 | + if (in_array($str, $arr)) |
|
331 | 331 | { |
332 | - return $this->arrConfig[ strtolower ( $str ) ]; |
|
332 | + return $this->arrConfig[strtolower($str)]; |
|
333 | 333 | } |
334 | 334 | |
335 | 335 | return; |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | |
23 | 23 | const SEPARETOR = "_"; |
24 | 24 | |
25 | - protected function init () |
|
25 | + protected function init() |
|
26 | 26 | { |
27 | 27 | } |
28 | 28 | |
@@ -31,31 +31,31 @@ discard block |
||
31 | 31 | * |
32 | 32 | * @return array |
33 | 33 | */ |
34 | - protected function getParams () |
|
34 | + protected function getParams() |
|
35 | 35 | { |
36 | 36 | |
37 | 37 | } |
38 | 38 | |
39 | - protected function parseFrameworkConfig () |
|
39 | + protected function parseFrameworkConfig() |
|
40 | 40 | { |
41 | 41 | // TODO: Implement parseFrameworkConfig() method. |
42 | 42 | } |
43 | 43 | |
44 | - public function createClassNamespace ( $table ) |
|
44 | + public function createClassNamespace($table) |
|
45 | 45 | { |
46 | - $arrNames = array ( |
|
47 | - $this->arrConfig[ 'namespace' ], |
|
46 | + $arrNames = array( |
|
47 | + $this->arrConfig['namespace'], |
|
48 | 48 | 'Model' |
49 | 49 | ); |
50 | - if ( $table->hasSchema () ) |
|
50 | + if ($table->hasSchema()) |
|
51 | 51 | { |
52 | - $arrNames[] = AbstractMaker::getClassName ( $table->getSchema () ); |
|
52 | + $arrNames[] = AbstractMaker::getClassName($table->getSchema()); |
|
53 | 53 | } else |
54 | 54 | { |
55 | - $arrNames[] = AbstractMaker::getClassName ( $table->getDatabase() ); |
|
55 | + $arrNames[] = AbstractMaker::getClassName($table->getDatabase()); |
|
56 | 56 | } |
57 | 57 | |
58 | - return implode ( '_', array_filter ( $arrNames ) ); |
|
58 | + return implode('_', array_filter($arrNames)); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |
@@ -63,12 +63,12 @@ discard block |
||
63 | 63 | * |
64 | 64 | * @return AbstractAdapter[] |
65 | 65 | */ |
66 | - public function getMakeFileInstances () |
|
66 | + public function getMakeFileInstances() |
|
67 | 67 | { |
68 | - return array ( |
|
69 | - DbTable::getInstance (), |
|
70 | - Entity::getInstance (), |
|
71 | - Model::getInstance () |
|
68 | + return array( |
|
69 | + DbTable::getInstance(), |
|
70 | + Entity::getInstance(), |
|
71 | + Model::getInstance() |
|
72 | 72 | ); |
73 | 73 | } |
74 | 74 |
@@ -107,7 +107,7 @@ |
||
107 | 107 | /** |
108 | 108 | * Cria Instancias dos arquivos que devem ser gerados |
109 | 109 | * |
110 | - * @return AbstractAdapter[] |
|
110 | + * @return \Classes\AdapterMakerFile\AbstractAdapter[] |
|
111 | 111 | */ |
112 | 112 | public function getMakeFileInstances () |
113 | 113 | { |
@@ -16,9 +16,9 @@ |
||
16 | 16 | { |
17 | 17 | private $msg = "As configuracoes a seguir sao obrigatorias: \033[0;31m%value%\033[0m"; |
18 | 18 | |
19 | - public function __construct ( $array , $code = 0 ) |
|
19 | + public function __construct($array, $code = 0) |
|
20 | 20 | { |
21 | - $attribs = implode ( ', ' , array_keys ( $array ) ); |
|
22 | - parent::__construct ( str_replace ( "%value%" , $attribs , $this->msg ) , (int) $code ); |
|
21 | + $attribs = implode(', ', array_keys($array)); |
|
22 | + parent::__construct(str_replace("%value%", $attribs, $this->msg), (int) $code); |
|
23 | 23 | } |
24 | 24 | } |
25 | 25 | \ No newline at end of file |
@@ -3,20 +3,20 @@ discard block |
||
3 | 3 | /** |
4 | 4 | * Application Model DbTables |
5 | 5 | * |
6 | - * <?=$this->config->last_modify."\n"?> |
|
6 | + * <?=$this->config->last_modify . "\n"?> |
|
7 | 7 | * |
8 | 8 | * Tabela definida por 'tablename' |
9 | 9 | * |
10 | 10 | * @package <?=$objTables->getNamespace()?><?="\n"?> |
11 | 11 | * @subpackage DbTable |
12 | - * @author <?=$this->config->author."\n"?> |
|
12 | + * @author <?=$this->config->author . "\n"?> |
|
13 | 13 | * |
14 | - * @copyright <?=$this->config->copyright."\n"?> |
|
15 | - * @license <?=$this->config->license."\n"?> |
|
16 | - * @link <?=$this->config->link."\n"?> |
|
14 | + * @copyright <?=$this->config->copyright . "\n"?> |
|
15 | + * @license <?=$this->config->license . "\n"?> |
|
16 | + * @link <?=$this->config->link . "\n"?> |
|
17 | 17 | */ |
18 | 18 | |
19 | -class <?=$objTables->getNamespace()?>_DbTable_<?=\Classes\Maker\AbstractMaker::getClassName ( $objTables->getName () )?> extends <?=$this->config->namespace?>Model_<?=$objMakeFile->getParentClass() . "\n"?> |
|
19 | +class <?=$objTables->getNamespace()?>_DbTable_<?=\Classes\Maker\AbstractMaker::getClassName($objTables->getName())?> extends <?=$this->config->namespace?>Model_<?=$objMakeFile->getParentClass() . "\n"?> |
|
20 | 20 | { |
21 | 21 | /** |
22 | 22 | * Nome da tabela do banco de dados |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * @access protected |
26 | 26 | */ |
27 | 27 | protected $_name = '<?=$objTables->getName()?>'; |
28 | -<?php if($objTables->hasSchema()): ?> |
|
28 | +<?php if ($objTables->hasSchema()): ?> |
|
29 | 29 | |
30 | 30 | /** |
31 | 31 | * Schema da tabela do banco de dados |
@@ -42,9 +42,9 @@ discard block |
||
42 | 42 | * @var string |
43 | 43 | * @access protected |
44 | 44 | */ |
45 | - protected $_rowClass = '<?=$objTables->getNamespace()?>_<?=\Classes\Maker\AbstractMaker::getClassName ( $objTables->getName () )?>'; |
|
45 | + protected $_rowClass = '<?=$objTables->getNamespace()?>_<?=\Classes\Maker\AbstractMaker::getClassName($objTables->getName())?>'; |
|
46 | 46 | |
47 | -<?php if( $objTables->hasPrimaryKey() ):?> |
|
47 | +<?php if ($objTables->hasPrimaryKey()):?> |
|
48 | 48 | /** |
49 | 49 | * Nome da Primary Key |
50 | 50 | * |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | * @access protected |
53 | 53 | */ |
54 | 54 | protected $_primary = array( |
55 | -<?php foreach($objTables->getPrimaryKeys() as $pks):?> |
|
55 | +<?php foreach ($objTables->getPrimaryKeys() as $pks):?> |
|
56 | 56 | '<?=$pks->getName()?>', |
57 | 57 | <?php endforeach; ?> |
58 | 58 | ); |
@@ -63,9 +63,9 @@ discard block |
||
63 | 63 | * |
64 | 64 | * @var mixed |
65 | 65 | */ |
66 | -<?php if( $objTables->hasSequences() ) : ?> |
|
67 | -<?php elseif ( 1 == count($objTables->getSequences() ) ) : ?> |
|
68 | -<?php $seqs = $objTables->getSequences();reset($seqs);$seq = current($seqs);?> |
|
66 | +<?php if ($objTables->hasSequences()) : ?> |
|
67 | +<?php elseif (1 == count($objTables->getSequences())) : ?> |
|
68 | +<?php $seqs = $objTables->getSequences(); reset($seqs); $seq = current($seqs); ?> |
|
69 | 69 | protected $_sequence = '<?=$seq->getSequence() ?>'; |
70 | 70 | <?php else: ?> |
71 | 71 | protected $_sequence = false; |
@@ -1,19 +1,19 @@ discard block |
||
1 | 1 | <?="<?php\n"?> |
2 | -<?php $className = $objTables->getNamespace(). '_Entity_' . \Classes\Maker\AbstractMaker::getClassName ( $objTables->getName () )?> |
|
2 | +<?php $className = $objTables->getNamespace() . '_Entity_' . \Classes\Maker\AbstractMaker::getClassName($objTables->getName())?> |
|
3 | 3 | |
4 | 4 | /** |
5 | 5 | * Application Entity |
6 | 6 | * |
7 | - * <?=$this->config->last_modify."\n"?> |
|
7 | + * <?=$this->config->last_modify . "\n"?> |
|
8 | 8 | * |
9 | - * @package <?=$objTables->getNamespace()."\n"?> |
|
9 | + * @package <?=$objTables->getNamespace() . "\n"?> |
|
10 | 10 | * @subpackage Entity |
11 | 11 | * |
12 | - * @author <?=$this->config->author."\n"?> |
|
12 | + * @author <?=$this->config->author . "\n"?> |
|
13 | 13 | * |
14 | - * @copyright <?=$this->config->copyright."\n"?> |
|
15 | - * @license <?=$this->config->license."\n"?> |
|
16 | - * @link <?=$this->config->link."\n"?> |
|
14 | + * @copyright <?=$this->config->copyright . "\n"?> |
|
15 | + * @license <?=$this->config->license . "\n"?> |
|
16 | + * @link <?=$this->config->link . "\n"?> |
|
17 | 17 | */ |
18 | 18 | |
19 | 19 | /** |
@@ -25,11 +25,11 @@ discard block |
||
25 | 25 | |
26 | 26 | <?php foreach ($objTables->getColumns() as $column): ?> |
27 | 27 | /** |
28 | - * Database constraint in the column <?=$column->getName()."\n"?> |
|
28 | + * Database constraint in the column <?=$column->getName() . "\n"?> |
|
29 | 29 | * |
30 | 30 | */ |
31 | 31 | const <?=strtoupper($column->getName())?> = '<?=$objTables->getName()?>.<?=$column->getName()?>'; |
32 | -<?php endforeach;?> |
|
32 | +<?php endforeach; ?> |
|
33 | 33 | |
34 | 34 | /** |
35 | 35 | * Nome da tabela DbTable do model |
@@ -37,16 +37,16 @@ discard block |
||
37 | 37 | * @var string |
38 | 38 | * @access protected |
39 | 39 | */ |
40 | - protected $_tableClass = '<?=$objTables->getNamespace()?>_DbTable_<?=\Classes\Maker\AbstractMaker::getClassName ( $objTables->getName () )?>'; |
|
40 | + protected $_tableClass = '<?=$objTables->getNamespace()?>_DbTable_<?=\Classes\Maker\AbstractMaker::getClassName($objTables->getName())?>'; |
|
41 | 41 | |
42 | 42 | /** |
43 | 43 | * @see <?=$this->config->namespace?>Model_EntityAbstract::$_filters |
44 | 44 | */ |
45 | 45 | protected $_filters = array( |
46 | -<?php foreach ( $objTables->getColumns () as $column ): ?> |
|
46 | +<?php foreach ($objTables->getColumns() as $column): ?> |
|
47 | 47 | <?php |
48 | 48 | $filters = null; |
49 | - switch ( ucfirst ( $column->getType () ) ) |
|
49 | + switch (ucfirst($column->getType())) |
|
50 | 50 | { |
51 | 51 | case 'String': |
52 | 52 | $filters = 'StripTags", "StringTrim'; |
@@ -55,50 +55,50 @@ discard block |
||
55 | 55 | $filters = 'Digits'; |
56 | 56 | break; |
57 | 57 | default: |
58 | - $filters = ucfirst ( $column->getType () ); |
|
58 | + $filters = ucfirst($column->getType()); |
|
59 | 59 | break; |
60 | 60 | } |
61 | 61 | ?> |
62 | 62 | '<?=$column->getName()?>'=>array ( |
63 | - <?=( !empty( $filters ) ) ? "\"{$filters}\"\n" : null; ?> |
|
63 | + <?=( ! empty($filters)) ? "\"{$filters}\"\n" : null; ?> |
|
64 | 64 | ), |
65 | -<?php endforeach;?> |
|
65 | +<?php endforeach; ?> |
|
66 | 66 | ); |
67 | 67 | |
68 | 68 | /** |
69 | 69 | * @see <?=$this->config->namespace?>Model_EntityAbstract::$_validators |
70 | 70 | */ |
71 | 71 | protected $_validators= array( |
72 | -<?php foreach ( $objTables->getColumns () as $column ): ?> |
|
72 | +<?php foreach ($objTables->getColumns() as $column): ?> |
|
73 | 73 | <?php |
74 | - $validators = array (); |
|
74 | + $validators = array(); |
|
75 | 75 | |
76 | - $validators[] = $column->isNullable () ? "'allowEmpty' => true" : "'NotEmpty'"; |
|
76 | + $validators[] = $column->isNullable() ? "'allowEmpty' => true" : "'NotEmpty'"; |
|
77 | 77 | |
78 | - switch ( ucfirst ( $column->getType () ) ) |
|
78 | + switch (ucfirst($column->getType())) |
|
79 | 79 | { |
80 | 80 | case 'String': |
81 | - if ( $column->getMaxLength () ) |
|
81 | + if ($column->getMaxLength()) |
|
82 | 82 | { |
83 | - $validators[] = "array( 'StringLength', array( 'max' => " . $column->getMaxLength () . " ) )"; |
|
83 | + $validators[] = "array( 'StringLength', array( 'max' => " . $column->getMaxLength() . " ) )"; |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | break; |
87 | 87 | case 'Boolean': |
88 | 88 | break; |
89 | 89 | default: |
90 | - $name = ucfirst ( $column->getType () ); |
|
90 | + $name = ucfirst($column->getType()); |
|
91 | 91 | $validators[] = "'$name'"; |
92 | 92 | break; |
93 | 93 | } |
94 | - $validators = implode ( ", ", $validators )?> |
|
95 | - '<?= $column->getName () ?>' => array ( |
|
96 | - <?=( !empty( $validators ) ) ? "{$validators}\n" : null?> |
|
94 | + $validators = implode(", ", $validators)?> |
|
95 | + '<?= $column->getName() ?>' => array ( |
|
96 | + <?=( ! empty($validators)) ? "{$validators}\n" : null?> |
|
97 | 97 | ), |
98 | 98 | <?php endforeach; ?> |
99 | 99 | ); |
100 | 100 | |
101 | -<?php if( $objTables->hasPrimaryKey() ):?> |
|
101 | +<?php if ($objTables->hasPrimaryKey()):?> |
|
102 | 102 | /** |
103 | 103 | * Nome da Primary Key |
104 | 104 | * |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | */ |
108 | 108 | |
109 | 109 | protected $_primary = array( |
110 | - <?php foreach($objTables->getPrimarykeys() as $pks) : ?> |
|
110 | + <?php foreach ($objTables->getPrimarykeys() as $pks) : ?> |
|
111 | 111 | '<?=$pks->getName()?>', |
112 | 112 | <?php endforeach ?> |
113 | 113 | ); |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | */ |
122 | 122 | protected $_parent_<?=$parent['name']?>; |
123 | 123 | |
124 | -<?php endforeach;?> |
|
124 | +<?php endforeach; ?> |
|
125 | 125 | <?php foreach ($depends as $depend): ?> |
126 | 126 | /** |
127 | 127 | * Depends relation <?=\Classes\Maker\AbstractMaker::getClassName($depend['table']) . "\n"?> |
@@ -130,13 +130,13 @@ discard block |
||
130 | 130 | */ |
131 | 131 | protected $_depend_<?=$depend['name']?>; |
132 | 132 | |
133 | -<?php endforeach;?> |
|
133 | +<?php endforeach; ?> |
|
134 | 134 | <?php foreach ($objTables->getColumns() as $column): ?> |
135 | 135 | /** |
136 | 136 | * |
137 | - * Sets column <?=$column->getName()."\n"?> |
|
137 | + * Sets column <?=$column->getName() . "\n"?> |
|
138 | 138 | * |
139 | -<?php if ($column->getType()=='date'): ?> |
|
139 | +<?php if ($column->getType() == 'date'): ?> |
|
140 | 140 | * Stored in ISO 8601 format. |
141 | 141 | * |
142 | 142 | * @param string|Zend_Date $<?=$column->getName() . "\n"?> |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | */ |
148 | 148 | public function set<?=\Classes\Maker\AbstractMaker::getClassName($column->getName())?>($<?=$column->getName()?>) |
149 | 149 | { |
150 | -<?php switch ( $column->getType () ): |
|
150 | +<?php switch ($column->getType()): |
|
151 | 151 | case 'date': ?> |
152 | 152 | if (! empty($<?=$column->getName()?>)) |
153 | 153 | { |
@@ -186,16 +186,16 @@ discard block |
||
186 | 186 | /** |
187 | 187 | * Gets column <?=$column->getName() . "\n"?> |
188 | 188 | * |
189 | -<?php if ($column->getType()=='date'): ?> |
|
189 | +<?php if ($column->getType() == 'date'): ?> |
|
190 | 190 | * @param boolean $returnZendDate |
191 | 191 | * @return Zend_Date|null|string Zend_Date representation of this datetime if enabled, or ISO 8601 string if not |
192 | 192 | <?php else: ?> |
193 | 193 | * @return <?=$column->getType() . "\n"?> |
194 | 194 | <?php endif; ?> |
195 | 195 | */ |
196 | - public function get<?=\Classes\Maker\AbstractMaker::getClassName($column->getName())?>(<?php if ($column->getType()=='date'): ?>$returnZendDate = false <?php endif;?>) |
|
196 | + public function get<?=\Classes\Maker\AbstractMaker::getClassName($column->getName())?>(<?php if ($column->getType() == 'date'): ?>$returnZendDate = false <?php endif; ?>) |
|
197 | 197 | { |
198 | -<?php if ($column->getType()=='date'): ?> |
|
198 | +<?php if ($column->getType() == 'date'): ?> |
|
199 | 199 | if ($returnZendDate) |
200 | 200 | { |
201 | 201 | if ($this->_data['<?=$column->getName()?>'] === null) |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | { |
222 | 222 | if ($this->_parent_<?=$parent['name']?> === null) |
223 | 223 | { |
224 | - $this->_parent_<?=$parent['name']?> = $this->findParentRow('<?=$objTables->getNamespace()?>_DbTable_<?=\Classes\Maker\AbstractMaker::getClassName ($parent['table'])?>', '<?=\Classes\Maker\AbstractMaker::getClassName($parent['name'])?>'); |
|
224 | + $this->_parent_<?=$parent['name']?> = $this->findParentRow('<?=$objTables->getNamespace()?>_DbTable_<?=\Classes\Maker\AbstractMaker::getClassName($parent['table'])?>', '<?=\Classes\Maker\AbstractMaker::getClassName($parent['name'])?>'); |
|
225 | 225 | } |
226 | 226 | |
227 | 227 | return $this->_parent_<?=$parent['name']?>; |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | { |
241 | 241 | if ($this->_depend_<?=$depend['name']?> === null) |
242 | 242 | { |
243 | - $this->_depend_<?=$depend['name']?> = $this->findDependentRowset('<?=$objTables->getNamespace()?>_DbTable_<?=\Classes\Maker\AbstractMaker::getClassName ($depend['table'])?>'); |
|
243 | + $this->_depend_<?=$depend['name']?> = $this->findDependentRowset('<?=$objTables->getNamespace()?>_DbTable_<?=\Classes\Maker\AbstractMaker::getClassName($depend['table'])?>'); |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | return $this->_depend_<?=$depend['name']?>; |
@@ -140,9 +140,12 @@ discard block |
||
140 | 140 | * Stored in ISO 8601 format. |
141 | 141 | * |
142 | 142 | * @param string|Zend_Date $<?=$column->getName() . "\n"?> |
143 | -<?php else: ?> |
|
143 | +<?php else { |
|
144 | + : ?> |
|
144 | 145 | * @param <?=$column->getType()?> $<?=$column->getName() . "\n"?> |
145 | -<?php endif; ?> |
|
146 | +<?php endif; |
|
147 | +} |
|
148 | +?> |
|
146 | 149 | * @return <?=$className . "\n"?> |
147 | 150 | */ |
148 | 151 | public function set<?=\Classes\Maker\AbstractMaker::getClassName($column->getName())?>($<?=$column->getName()?>) |
@@ -189,9 +192,12 @@ discard block |
||
189 | 192 | <?php if ($column->getType()=='date'): ?> |
190 | 193 | * @param boolean $returnZendDate |
191 | 194 | * @return Zend_Date|null|string Zend_Date representation of this datetime if enabled, or ISO 8601 string if not |
192 | -<?php else: ?> |
|
195 | +<?php else { |
|
196 | + : ?> |
|
193 | 197 | * @return <?=$column->getType() . "\n"?> |
194 | -<?php endif; ?> |
|
198 | +<?php endif; |
|
199 | +} |
|
200 | +?> |
|
195 | 201 | */ |
196 | 202 | public function get<?=\Classes\Maker\AbstractMaker::getClassName($column->getName())?>(<?php if ($column->getType()=='date'): ?>$returnZendDate = false <?php endif;?>) |
197 | 203 | { |
@@ -3,19 +3,19 @@ |
||
3 | 3 | /** |
4 | 4 | * Data Entity implementation for this class |
5 | 5 | * |
6 | - * <?=$this->config->last_modify."\n"?> |
|
6 | + * <?=$this->config->last_modify . "\n"?> |
|
7 | 7 | * |
8 | 8 | * @package <?=$objTables->getNamespace()?> |
9 | - * @see <?=$objTables->getNamespace()?>_Entity_<?=\Classes\Maker\AbstractMaker::getClassName ( $objTables->getName () )?>. <?="\n"?> |
|
9 | + * @see <?=$objTables->getNamespace()?>_Entity_<?=\Classes\Maker\AbstractMaker::getClassName($objTables->getName())?>. <?="\n"?> |
|
10 | 10 | * |
11 | - * @author <?=$this->config->author."\n"?> |
|
11 | + * @author <?=$this->config->author . "\n"?> |
|
12 | 12 | * |
13 | - * @copyright <?=$this->config->copyright."\n"?> |
|
14 | - * @license <?=$this->config->license."\n"?> |
|
15 | - * @link <?=$this->config->link."\n"?> |
|
13 | + * @copyright <?=$this->config->copyright . "\n"?> |
|
14 | + * @license <?=$this->config->license . "\n"?> |
|
15 | + * @link <?=$this->config->link . "\n"?> |
|
16 | 16 | */ |
17 | 17 | |
18 | -class <?=$objTables->getNamespace()?>_<?=\Classes\Maker\AbstractMaker::getClassName ( $objTables->getName () )?> extends <?=$objTables->getNamespace()?>_Entity_<?=\Classes\Maker\AbstractMaker::getClassName ( $objTables->getName () ). "\n"?> |
|
18 | +class <?=$objTables->getNamespace()?>_<?=\Classes\Maker\AbstractMaker::getClassName($objTables->getName())?> extends <?=$objTables->getNamespace()?>_Entity_<?=\Classes\Maker\AbstractMaker::getClassName($objTables->getName()) . "\n"?> |
|
19 | 19 | { |
20 | 20 | /* Codifique aqui */ |
21 | 21 | } |
@@ -3,15 +3,15 @@ |
||
3 | 3 | /** |
4 | 4 | * Application Entity |
5 | 5 | * |
6 | - * <?=$this->config->last_modify."\n"?> |
|
6 | + * <?=$this->config->last_modify . "\n"?> |
|
7 | 7 | * |
8 | 8 | * @package <?=$this->config->namespace?>Model |
9 | 9 | * @subpackage Model |
10 | - * @author <?=$this->config->author."\n"?> |
|
10 | + * @author <?=$this->config->author . "\n"?> |
|
11 | 11 | * |
12 | - * @copyright <?=$this->config->copyright."\n"?> |
|
13 | - * @license <?=$this->config->license."\n"?> |
|
14 | - * @link <?=$this->config->link."\n"?> |
|
12 | + * @copyright <?=$this->config->copyright . "\n"?> |
|
13 | + * @license <?=$this->config->license . "\n"?> |
|
14 | + * @link <?=$this->config->link . "\n"?> |
|
15 | 15 | */ |
16 | 16 | |
17 | 17 | abstract class <?=$this->config->namespace?>Model_EntityAbstract extends Zend_Db_Table_Row_Abstract |
@@ -3,19 +3,19 @@ |
||
3 | 3 | /** |
4 | 4 | * Data Model implementation for this class |
5 | 5 | * |
6 | - * <?=$this->config->last_modify."\n"?> |
|
6 | + * <?=$this->config->last_modify . "\n"?> |
|
7 | 7 | * |
8 | 8 | * @package <?=$objTables->getNamespace()?> |
9 | - * @see <?=$objTables->getNamespace()?>/Model/<?=$this->getClassName ( $objTables->getName () )?>. "\n"?> |
|
9 | + * @see <?=$objTables->getNamespace()?>/Model/<?=$this->getClassName($objTables->getName())?>. "\n"?> |
|
10 | 10 | * |
11 | - * @author <?=$this->config->author."\n"?> |
|
11 | + * @author <?=$this->config->author . "\n"?> |
|
12 | 12 | * |
13 | - * @copyright <?=$this->config->copyright."\n"?> |
|
14 | - * @license <?=$this->config->license."\n"?> |
|
15 | - * @link <?=$this->config->link."\n"?> |
|
13 | + * @copyright <?=$this->config->copyright . "\n"?> |
|
14 | + * @license <?=$this->config->license . "\n"?> |
|
15 | + * @link <?=$this->config->link . "\n"?> |
|
16 | 16 | */ |
17 | 17 | |
18 | -class <?=$this->getClassName ( $objTables->getName () )?> extends <?=$objTables->getNamespace()?>/Model/<?=$this->getClassName ( $objTables->getName () ). "\n"?> |
|
18 | +class <?=$this->getClassName($objTables->getName())?> extends <?=$objTables->getNamespace()?>/Model/<?=$this->getClassName($objTables->getName()) . "\n"?> |
|
19 | 19 | { |
20 | 20 | /* Codifique aqui */ |
21 | 21 | } |
@@ -3,22 +3,22 @@ |
||
3 | 3 | /** |
4 | 4 | * Mvc Model |
5 | 5 | * |
6 | - * <?=$this->config->last_modify."\n"?> |
|
6 | + * <?=$this->config->last_modify . "\n"?> |
|
7 | 7 | * |
8 | 8 | * @package <?=$this->config->namespace?>Model |
9 | 9 | * @subpackage Model |
10 | - * @author <?=$this->config->author."\n"?> |
|
10 | + * @author <?=$this->config->author . "\n"?> |
|
11 | 11 | * |
12 | - * @copyright <?=$this->config->copyright."\n"?> |
|
13 | - * @license <?=$this->config->license."\n"?> |
|
14 | - * @link <?=$this->config->link."\n"?> |
|
12 | + * @copyright <?=$this->config->copyright . "\n"?> |
|
13 | + * @license <?=$this->config->license . "\n"?> |
|
14 | + * @link <?=$this->config->link . "\n"?> |
|
15 | 15 | */ |
16 | 16 | |
17 | 17 | namespace <?=$objTables->getNamespace()?>; |
18 | 18 | |
19 | 19 | use Phalcon\Mvc\Model; |
20 | 20 | |
21 | -abstract class <?=\Classes\Maker\AbstractMaker::getClassName ( $objTables->getName () )?> extends Model |
|
21 | +abstract class <?=\Classes\Maker\AbstractMaker::getClassName($objTables->getName())?> extends Model |
|
22 | 22 | { |
23 | 23 | |
24 | 24 | } |
25 | 25 | \ No newline at end of file |