@@ -22,11 +22,11 @@ discard block |
||
| 22 | 22 | * @var string |
| 23 | 23 | */ |
| 24 | 24 | protected $framework = "phalcon"; |
| 25 | - public $reservedWord = array ( 'public' => 'Main' ); |
|
| 25 | + public $reservedWord = array('public' => 'Main'); |
|
| 26 | 26 | |
| 27 | 27 | const SEPARETOR = "\\"; |
| 28 | 28 | |
| 29 | - protected function init () |
|
| 29 | + protected function init() |
|
| 30 | 30 | { |
| 31 | 31 | } |
| 32 | 32 | |
@@ -35,12 +35,12 @@ discard block |
||
| 35 | 35 | * |
| 36 | 36 | * @return array |
| 37 | 37 | */ |
| 38 | - protected function getParams () |
|
| 38 | + protected function getParams() |
|
| 39 | 39 | { |
| 40 | 40 | |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - protected function parseFrameworkConfig () |
|
| 43 | + protected function parseFrameworkConfig() |
|
| 44 | 44 | { |
| 45 | 45 | // TODO: Implement parseFrameworkConfig() method. |
| 46 | 46 | } |
@@ -48,10 +48,10 @@ discard block |
||
| 48 | 48 | /** |
| 49 | 49 | * @inheritdoc |
| 50 | 50 | */ |
| 51 | - protected function getBaseNamespace () |
|
| 51 | + protected function getBaseNamespace() |
|
| 52 | 52 | { |
| 53 | - return array ( |
|
| 54 | - $this->arrConfig[ 'namespace' ], |
|
| 53 | + return array( |
|
| 54 | + $this->arrConfig['namespace'], |
|
| 55 | 55 | 'Models' |
| 56 | 56 | ); |
| 57 | 57 | } |
@@ -61,12 +61,12 @@ discard block |
||
| 61 | 61 | * |
| 62 | 62 | * @return \Classes\AdapterMakerFile\AbstractAdapter[] |
| 63 | 63 | */ |
| 64 | - public function getMakeFileInstances () |
|
| 64 | + public function getMakeFileInstances() |
|
| 65 | 65 | { |
| 66 | - return array ( |
|
| 67 | - Entity::getInstance (), |
|
| 68 | - Model::getInstance (), |
|
| 69 | - Peer::getInstance () |
|
| 66 | + return array( |
|
| 67 | + Entity::getInstance(), |
|
| 68 | + Model::getInstance(), |
|
| 69 | + Peer::getInstance() |
|
| 70 | 70 | ); |
| 71 | 71 | } |
| 72 | 72 | |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | abstract class AbstractAdapter |
| 17 | 17 | { |
| 18 | 18 | |
| 19 | - protected $arrConfig = array ( |
|
| 19 | + protected $arrConfig = array( |
|
| 20 | 20 | ############################# DATABASE |
| 21 | 21 | //Driver do banco de dados |
| 22 | 22 | 'driver' => null, |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | //senha do banco |
| 32 | 32 | 'password' => null, |
| 33 | 33 | // lista de schemas do banco de dados |
| 34 | - 'schema' => array (), |
|
| 34 | + 'schema' => array(), |
|
| 35 | 35 | 'version' => '', |
| 36 | 36 | 'socket' => null, |
| 37 | 37 | |
@@ -64,13 +64,13 @@ discard block |
||
| 64 | 64 | // flags para criar todas as tabelas ou nao |
| 65 | 65 | 'allTables' => true, |
| 66 | 66 | //Lista de tabelas a serem ignoradas |
| 67 | - 'ignoreTable' => array (), |
|
| 67 | + 'ignoreTable' => array(), |
|
| 68 | 68 | ); |
| 69 | 69 | |
| 70 | 70 | /** |
| 71 | 71 | * @var string[] um array com todos os campos obrigatorios |
| 72 | 72 | */ |
| 73 | - protected $attRequered = array ( |
|
| 73 | + protected $attRequered = array( |
|
| 74 | 74 | 'driver' => true, |
| 75 | 75 | 'database' => true, |
| 76 | 76 | 'host' => true, |
@@ -78,11 +78,11 @@ discard block |
||
| 78 | 78 | 'path' => true |
| 79 | 79 | ); |
| 80 | 80 | |
| 81 | - protected $arrFunc = array (); |
|
| 81 | + protected $arrFunc = array(); |
|
| 82 | 82 | |
| 83 | - private $framworkFiles = array (); |
|
| 83 | + private $framworkFiles = array(); |
|
| 84 | 84 | |
| 85 | - public $reservedWord = array (); |
|
| 85 | + public $reservedWord = array(); |
|
| 86 | 86 | |
| 87 | 87 | const SEPARETOR = ""; |
| 88 | 88 | |
@@ -91,9 +91,9 @@ discard block |
||
| 91 | 91 | * |
| 92 | 92 | * @return bool |
| 93 | 93 | */ |
| 94 | - protected function checkConfig () |
|
| 94 | + protected function checkConfig() |
|
| 95 | 95 | { |
| 96 | - if ( array_diff_key ( $this->attRequered, array_filter ( $this->arrConfig ) ) ) { |
|
| 96 | + if (array_diff_key($this->attRequered, array_filter($this->arrConfig))) { |
|
| 97 | 97 | return false; |
| 98 | 98 | } |
| 99 | 99 | |
@@ -105,33 +105,33 @@ discard block |
||
| 105 | 105 | * |
| 106 | 106 | * @return array |
| 107 | 107 | */ |
| 108 | - abstract protected function getParams (); |
|
| 108 | + abstract protected function getParams(); |
|
| 109 | 109 | |
| 110 | 110 | /** |
| 111 | 111 | * Popula as config do generater com as configuraçoes do framework |
| 112 | 112 | * |
| 113 | 113 | * @return mixed |
| 114 | 114 | */ |
| 115 | - abstract protected function parseFrameworkConfig (); |
|
| 115 | + abstract protected function parseFrameworkConfig(); |
|
| 116 | 116 | |
| 117 | 117 | /** |
| 118 | 118 | * Cria Instancias dos arquivos que devem ser gerados |
| 119 | 119 | * |
| 120 | 120 | * @return \Classes\AdapterMakerFile\AbstractAdapter[] |
| 121 | 121 | */ |
| 122 | - abstract public function getMakeFileInstances (); |
|
| 122 | + abstract public function getMakeFileInstances(); |
|
| 123 | 123 | |
| 124 | - abstract protected function init (); |
|
| 124 | + abstract protected function init(); |
|
| 125 | 125 | |
| 126 | 126 | /** |
| 127 | 127 | * retorna a base do Namespace |
| 128 | 128 | * |
| 129 | 129 | * @return array |
| 130 | 130 | */ |
| 131 | - protected function getBaseNamespace () |
|
| 131 | + protected function getBaseNamespace() |
|
| 132 | 132 | { |
| 133 | - return array ( |
|
| 134 | - $this->arrConfig[ 'namespace' ], |
|
| 133 | + return array( |
|
| 134 | + $this->arrConfig['namespace'], |
|
| 135 | 135 | 'Model' |
| 136 | 136 | ); |
| 137 | 137 | } |
@@ -142,48 +142,48 @@ discard block |
||
| 142 | 142 | * @return mixed |
| 143 | 143 | */ |
| 144 | 144 | |
| 145 | - public function createClassNamespace ( $table ) |
|
| 145 | + public function createClassNamespace($table) |
|
| 146 | 146 | { |
| 147 | - $arrNames = $this->getBaseNamespace (); |
|
| 147 | + $arrNames = $this->getBaseNamespace(); |
|
| 148 | 148 | |
| 149 | - if ( isset( $this->arrConfig[ 'folder-database' ] ) |
|
| 150 | - && $this->arrConfig[ 'folder-database' ] |
|
| 149 | + if (isset($this->arrConfig['folder-database']) |
|
| 150 | + && $this->arrConfig['folder-database'] |
|
| 151 | 151 | ) { |
| 152 | - $arrNames[] = AbstractMaker::getClassName ( $this->arrConfig[ 'driver' ] ); |
|
| 152 | + $arrNames[] = AbstractMaker::getClassName($this->arrConfig['driver']); |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | - if ( isset( $this->arrConfig[ 'folder-name' ] ) |
|
| 156 | - && $this->arrConfig[ 'folder-name' ] |
|
| 155 | + if (isset($this->arrConfig['folder-name']) |
|
| 156 | + && $this->arrConfig['folder-name'] |
|
| 157 | 157 | ) { |
| 158 | - $arrNames[] = AbstractMaker::getClassName ( $this->arrConfig[ 'folder-name' ] ); |
|
| 158 | + $arrNames[] = AbstractMaker::getClassName($this->arrConfig['folder-name']); |
|
| 159 | 159 | } |
| 160 | 160 | |
| 161 | - if ( $table->hasSchema () ) { |
|
| 162 | - $arrNames[] = $this->replaceReservedWord ( AbstractMaker::getClassName ( $table->getSchema () ) ); |
|
| 161 | + if ($table->hasSchema()) { |
|
| 162 | + $arrNames[] = $this->replaceReservedWord(AbstractMaker::getClassName($table->getSchema())); |
|
| 163 | 163 | } |
| 164 | 164 | else { |
| 165 | - $arrNames[] = $this->replaceReservedWord ( AbstractMaker::getClassName ( $table->getDatabase () ) ); |
|
| 165 | + $arrNames[] = $this->replaceReservedWord(AbstractMaker::getClassName($table->getDatabase())); |
|
| 166 | 166 | } |
| 167 | 167 | |
| 168 | - return implode ( static::SEPARETOR, array_filter ( $arrNames ) ); |
|
| 168 | + return implode(static::SEPARETOR, array_filter($arrNames)); |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | - public function __construct ( $array ) |
|
| 171 | + public function __construct($array) |
|
| 172 | 172 | { |
| 173 | - $array += array ( |
|
| 173 | + $array += array( |
|
| 174 | 174 | 'version' => Config::$version, |
| 175 | - 'author' => ucfirst ( get_current_user () ), |
|
| 176 | - 'last_modify' => date ( "d-m-Y H:i:s." ) |
|
| 175 | + 'author' => ucfirst(get_current_user()), |
|
| 176 | + 'last_modify' => date("d-m-Y H:i:s.") |
|
| 177 | 177 | ); |
| 178 | 178 | |
| 179 | - $this->setFrameworkFiles ( $array ); |
|
| 180 | - $this->parseFrameworkConfig (); |
|
| 181 | - $this->setParams ( $this->getParams () ); |
|
| 182 | - $this->setParams ( $array ); |
|
| 183 | - $this->init (); |
|
| 184 | - if ( !$this->isValid () ) { |
|
| 185 | - $var = array_diff_key ( $this->attRequered, array_filter ( $this->arrConfig ) ); |
|
| 186 | - throw new Exception( $var ); |
|
| 179 | + $this->setFrameworkFiles($array); |
|
| 180 | + $this->parseFrameworkConfig(); |
|
| 181 | + $this->setParams($this->getParams()); |
|
| 182 | + $this->setParams($array); |
|
| 183 | + $this->init(); |
|
| 184 | + if ( ! $this->isValid()) { |
|
| 185 | + $var = array_diff_key($this->attRequered, array_filter($this->arrConfig)); |
|
| 186 | + throw new Exception($var); |
|
| 187 | 187 | } |
| 188 | 188 | } |
| 189 | 189 | |
@@ -192,35 +192,35 @@ discard block |
||
| 192 | 192 | * |
| 193 | 193 | * @param $array |
| 194 | 194 | */ |
| 195 | - public function setFrameworkFiles ( $array ) |
|
| 195 | + public function setFrameworkFiles($array) |
|
| 196 | 196 | { |
| 197 | - $this->framworkFiles[ 'library' ] = isset( $array[ 'framework-path-library' ] ) ? $array[ 'framework-path-library' ] : null; |
|
| 197 | + $this->framworkFiles['library'] = isset($array['framework-path-library']) ? $array['framework-path-library'] : null; |
|
| 198 | 198 | |
| 199 | - $this->framworkFiles[ 'ini' ] = isset( $array[ 'framework-ini' ] ) ? $array[ 'framework-ini' ] : null; |
|
| 199 | + $this->framworkFiles['ini'] = isset($array['framework-ini']) ? $array['framework-ini'] : null; |
|
| 200 | 200 | |
| 201 | - $this->framworkFiles[ 'environment' ] = isset( $array[ 'environment' ] ) ? $array[ 'environment' ] : 'production'; |
|
| 201 | + $this->framworkFiles['environment'] = isset($array['environment']) ? $array['environment'] : 'production'; |
|
| 202 | 202 | |
| 203 | 203 | } |
| 204 | 204 | |
| 205 | - protected function isValidFrameworkFiles () |
|
| 205 | + protected function isValidFrameworkFiles() |
|
| 206 | 206 | { |
| 207 | - if ( !is_file ( $this->framworkFiles[ 'ini' ] ) ) { |
|
| 207 | + if ( ! is_file($this->framworkFiles['ini'])) { |
|
| 208 | 208 | return false; |
| 209 | 209 | } |
| 210 | 210 | |
| 211 | - if ( !is_dir ( $this->framworkFiles[ 'library' ] ) ) { |
|
| 211 | + if ( ! is_dir($this->framworkFiles['library'])) { |
|
| 212 | 212 | return false; |
| 213 | 213 | } |
| 214 | 214 | |
| 215 | - if ( !isset ( $this->framworkFiles[ 'environment' ] ) or empty( $this->framworkFiles[ 'environment' ] ) ) { |
|
| 215 | + if ( ! isset ($this->framworkFiles['environment']) or empty($this->framworkFiles['environment'])) { |
|
| 216 | 216 | return false; |
| 217 | 217 | } |
| 218 | - set_include_path ( |
|
| 219 | - implode ( |
|
| 218 | + set_include_path( |
|
| 219 | + implode( |
|
| 220 | 220 | PATH_SEPARATOR, |
| 221 | - array ( |
|
| 222 | - realpath ( $this->framworkFiles[ 'library' ] ), |
|
| 223 | - get_include_path (), |
|
| 221 | + array( |
|
| 222 | + realpath($this->framworkFiles['library']), |
|
| 223 | + get_include_path(), |
|
| 224 | 224 | ) |
| 225 | 225 | ) |
| 226 | 226 | ); |
@@ -228,110 +228,110 @@ discard block |
||
| 228 | 228 | return true; |
| 229 | 229 | } |
| 230 | 230 | |
| 231 | - protected function getFrameworkIni () |
|
| 231 | + protected function getFrameworkIni() |
|
| 232 | 232 | { |
| 233 | - return $this->framworkFiles[ 'ini' ]; |
|
| 233 | + return $this->framworkFiles['ini']; |
|
| 234 | 234 | } |
| 235 | 235 | |
| 236 | - protected function getEnvironment () |
|
| 236 | + protected function getEnvironment() |
|
| 237 | 237 | { |
| 238 | - return $this->framworkFiles[ 'environment' ]; |
|
| 238 | + return $this->framworkFiles['environment']; |
|
| 239 | 239 | } |
| 240 | 240 | |
| 241 | 241 | /** |
| 242 | 242 | * Popula as variaveis de acordo com o arquivo de configuração do seu framework |
| 243 | 243 | */ |
| 244 | - protected function isValid () |
|
| 244 | + protected function isValid() |
|
| 245 | 245 | { |
| 246 | - return $this->checkConfig (); |
|
| 246 | + return $this->checkConfig(); |
|
| 247 | 247 | } |
| 248 | 248 | |
| 249 | - private function setParams ( $array ) |
|
| 249 | + private function setParams($array) |
|
| 250 | 250 | { |
| 251 | - if ( count ( $array ) > 0 ) { |
|
| 252 | - $this->arrConfig = array_filter ( $array ) + $this->arrConfig; |
|
| 251 | + if (count($array) > 0) { |
|
| 252 | + $this->arrConfig = array_filter($array) + $this->arrConfig; |
|
| 253 | 253 | } |
| 254 | 254 | } |
| 255 | 255 | |
| 256 | 256 | /** |
| 257 | 257 | * @return string |
| 258 | 258 | */ |
| 259 | - public function getDatabase () |
|
| 259 | + public function getDatabase() |
|
| 260 | 260 | { |
| 261 | - return $this->arrConfig[ 'database' ]; |
|
| 261 | + return $this->arrConfig['database']; |
|
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 | /** |
| 265 | 265 | * @return bool |
| 266 | 266 | */ |
| 267 | - public function hasSchemas () |
|
| 267 | + public function hasSchemas() |
|
| 268 | 268 | { |
| 269 | - return !empty ( $this->arrConfig[ 'schema' ] ); |
|
| 269 | + return ! empty ($this->arrConfig['schema']); |
|
| 270 | 270 | } |
| 271 | 271 | |
| 272 | 272 | /** |
| 273 | 273 | * @return string[] |
| 274 | 274 | */ |
| 275 | - public function getSchemas () |
|
| 275 | + public function getSchemas() |
|
| 276 | 276 | { |
| 277 | - if ( is_string ( $this->arrConfig[ 'schema' ] ) ) { |
|
| 278 | - return array ( $this->arrConfig[ 'schema' ] ); |
|
| 277 | + if (is_string($this->arrConfig['schema'])) { |
|
| 278 | + return array($this->arrConfig['schema']); |
|
| 279 | 279 | } |
| 280 | 280 | |
| 281 | - return $this->arrConfig[ 'schema' ]; |
|
| 281 | + return $this->arrConfig['schema']; |
|
| 282 | 282 | } |
| 283 | 283 | |
| 284 | - public function setSchema ( $schema ) |
|
| 284 | + public function setSchema($schema) |
|
| 285 | 285 | { |
| 286 | - $this->arrConfig[ 'schema' ] = $schema; |
|
| 286 | + $this->arrConfig['schema'] = $schema; |
|
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | /** |
| 290 | 290 | * @return string |
| 291 | 291 | */ |
| 292 | - public function getHost () |
|
| 292 | + public function getHost() |
|
| 293 | 293 | { |
| 294 | - return $this->arrConfig[ 'host' ]; |
|
| 294 | + return $this->arrConfig['host']; |
|
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | /** |
| 298 | 298 | * @return int |
| 299 | 299 | */ |
| 300 | - public function getPort () |
|
| 300 | + public function getPort() |
|
| 301 | 301 | { |
| 302 | - return $this->arrConfig[ 'port' ]; |
|
| 302 | + return $this->arrConfig['port']; |
|
| 303 | 303 | } |
| 304 | 304 | |
| 305 | 305 | /** |
| 306 | 306 | * @return boolean |
| 307 | 307 | */ |
| 308 | - public function hasPort () |
|
| 308 | + public function hasPort() |
|
| 309 | 309 | { |
| 310 | - return !empty( $this->arrConfig[ 'port' ] ); |
|
| 310 | + return ! empty($this->arrConfig['port']); |
|
| 311 | 311 | } |
| 312 | 312 | |
| 313 | 313 | /** |
| 314 | 314 | * @return string |
| 315 | 315 | */ |
| 316 | - public function getSocket () |
|
| 316 | + public function getSocket() |
|
| 317 | 317 | { |
| 318 | - return $this->arrConfig[ 'socket' ]; |
|
| 318 | + return $this->arrConfig['socket']; |
|
| 319 | 319 | } |
| 320 | 320 | |
| 321 | 321 | /** |
| 322 | 322 | * @return string |
| 323 | 323 | */ |
| 324 | - public function getUser () |
|
| 324 | + public function getUser() |
|
| 325 | 325 | { |
| 326 | - return $this->arrConfig[ 'username' ]; |
|
| 326 | + return $this->arrConfig['username']; |
|
| 327 | 327 | } |
| 328 | 328 | |
| 329 | 329 | /** |
| 330 | 330 | * @return string |
| 331 | 331 | */ |
| 332 | - public function getPassword () |
|
| 332 | + public function getPassword() |
|
| 333 | 333 | { |
| 334 | - return $this->arrConfig[ 'password' ]; |
|
| 334 | + return $this->arrConfig['password']; |
|
| 335 | 335 | } |
| 336 | 336 | |
| 337 | 337 | /** |
@@ -339,10 +339,10 @@ discard block |
||
| 339 | 339 | * |
| 340 | 340 | * @return string |
| 341 | 341 | */ |
| 342 | - public function replaceReservedWord ( $palavra ) |
|
| 342 | + public function replaceReservedWord($palavra) |
|
| 343 | 343 | { |
| 344 | - if ( isset( $this->reservedWord[ strtolower ( $palavra ) ] ) ) { |
|
| 345 | - return $this->reservedWord[ strtolower ( $palavra ) ]; |
|
| 344 | + if (isset($this->reservedWord[strtolower($palavra)])) { |
|
| 345 | + return $this->reservedWord[strtolower($palavra)]; |
|
| 346 | 346 | } |
| 347 | 347 | |
| 348 | 348 | return $palavra; |
@@ -351,9 +351,9 @@ discard block |
||
| 351 | 351 | /** |
| 352 | 352 | * @return bool |
| 353 | 353 | */ |
| 354 | - public function isStatusEnabled () |
|
| 354 | + public function isStatusEnabled() |
|
| 355 | 355 | { |
| 356 | - return (bool) $this->arrConfig[ 'status' ]; |
|
| 356 | + return (bool) $this->arrConfig['status']; |
|
| 357 | 357 | } |
| 358 | 358 | |
| 359 | 359 | /** |
@@ -361,9 +361,9 @@ discard block |
||
| 361 | 361 | * |
| 362 | 362 | * @return string |
| 363 | 363 | */ |
| 364 | - public function __get ( $str ) |
|
| 364 | + public function __get($str) |
|
| 365 | 365 | { |
| 366 | - $arr = array ( |
|
| 366 | + $arr = array( |
|
| 367 | 367 | 'namespace', |
| 368 | 368 | 'framework', |
| 369 | 369 | 'author', |
@@ -377,8 +377,8 @@ discard block |
||
| 377 | 377 | 'folder-name' |
| 378 | 378 | ); |
| 379 | 379 | |
| 380 | - if ( in_array ( $str, $arr ) ) { |
|
| 381 | - return $this->arrConfig[ strtolower ( $str ) ]; |
|
| 380 | + if (in_array($str, $arr)) { |
|
| 381 | + return $this->arrConfig[strtolower($str)]; |
|
| 382 | 382 | } |
| 383 | 383 | |
| 384 | 384 | return; |
@@ -3,22 +3,22 @@ |
||
| 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 | - * @see <?=$objTables->getNamespace()?>\<?=$this->getClassName ( $objTables->getName () ). "\n"?> |
|
| 8 | + * @see <?=$objTables->getNamespace()?>\<?=$this->getClassName($objTables->getName()) . "\n"?> |
|
| 9 | 9 | * |
| 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"?> |
|
| 15 | - * @version <?=$this->config->version."\n"?> |
|
| 12 | + * @copyright <?=$this->config->copyright . "\n"?> |
|
| 13 | + * @license <?=$this->config->license . "\n"?> |
|
| 14 | + * @link <?=$this->config->link . "\n"?> |
|
| 15 | + * @version <?=$this->config->version . "\n"?> |
|
| 16 | 16 | */ |
| 17 | 17 | |
| 18 | 18 | |
| 19 | 19 | namespace <?=$objTables->getNamespace()?>; |
| 20 | 20 | |
| 21 | -class <?=$this->getClassName ( $objTables->getName () )?> extends \<?=$objTables->getNamespace()?>\Entity\<?=$this->getClassName ( $objTables->getName () ). "\n"?> |
|
| 21 | +class <?=$this->getClassName($objTables->getName())?> extends \<?=$objTables->getNamespace()?>\Entity\<?=$this->getClassName($objTables->getName()) . "\n"?> |
|
| 22 | 22 | { |
| 23 | 23 | /* @TODO Codifique aqui */ |
| 24 | 24 | } |
@@ -3,43 +3,43 @@ discard block |
||
| 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 <?=$objTables->getNamespace()?>\Entity |
| 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"?> |
|
| 15 | - * @version <?=$this->config->version."\n"?> |
|
| 12 | + * @copyright <?=$this->config->copyright . "\n"?> |
|
| 13 | + * @license <?=$this->config->license . "\n"?> |
|
| 14 | + * @link <?=$this->config->link . "\n"?> |
|
| 15 | + * @version <?=$this->config->version . "\n"?> |
|
| 16 | 16 | */ |
| 17 | 17 | |
| 18 | 18 | namespace <?=$objTables->getNamespace()?>\Entity; |
| 19 | 19 | |
| 20 | 20 | use Phalcon\Validation; |
| 21 | 21 | |
| 22 | -abstract class <?=\Classes\Maker\AbstractMaker::getClassName ( $objTables->getName () )?> extends \Phalcon\Mvc\Model |
|
| 22 | +abstract class <?=\Classes\Maker\AbstractMaker::getClassName($objTables->getName())?> extends \Phalcon\Mvc\Model |
|
| 23 | 23 | { |
| 24 | 24 | |
| 25 | 25 | <?php foreach ($objTables->getColumns() as $column): ?> |
| 26 | 26 | /** |
| 27 | - * column <?=$column->getName()."\n"?> |
|
| 27 | + * column <?=$column->getName() . "\n"?> |
|
| 28 | 28 | * |
| 29 | -<?php if($column->isPrimaryKey()):?> |
|
| 29 | +<?php if ($column->isPrimaryKey()):?> |
|
| 30 | 30 | * @Primary |
| 31 | 31 | <?php endif ?> |
| 32 | -<?php if($column->hasSequence()):?> |
|
| 32 | +<?php if ($column->hasSequence()):?> |
|
| 33 | 33 | * @Identity |
| 34 | 34 | <?php endif ?> |
| 35 | - * @Column(type="<?=$column->getType()?>", nullable=<?=$column->isNullable () ? "true" : "false"?><?php |
|
| 36 | -if ( $column->getMaxLength () ): ?> |
|
| 37 | -, length=<?=$column->getMaxLength ()?> |
|
| 35 | + * @Column(type="<?=$column->getType()?>", nullable=<?=$column->isNullable() ? "true" : "false"?><?php |
|
| 36 | +if ($column->getMaxLength()): ?> |
|
| 37 | +, length=<?=$column->getMaxLength()?> |
|
| 38 | 38 | <?php endif ?>) |
| 39 | 39 | */ |
| 40 | 40 | protected $<?=$column->getName()?>; |
| 41 | 41 | |
| 42 | -<?php endforeach;?> |
|
| 42 | +<?php endforeach; ?> |
|
| 43 | 43 | /** |
| 44 | 44 | * Validations and business logic |
| 45 | 45 | * |
@@ -50,14 +50,14 @@ discard block |
||
| 50 | 50 | $validator = new Validation(); |
| 51 | 51 | |
| 52 | 52 | <?php foreach ($objTables->getColumns() as $column): ?> |
| 53 | -<?php if(strtolower($column->getName()) == 'email'):?> |
|
| 53 | +<?php if (strtolower($column->getName()) == 'email'):?> |
|
| 54 | 54 | $validator->add( |
| 55 | 55 | 'email', |
| 56 | 56 | new \Phalcon\Validation\Validator\Email() |
| 57 | 57 | ); |
| 58 | 58 | |
| 59 | 59 | <?php endif ?> |
| 60 | -<?php endforeach;?> |
|
| 60 | +<?php endforeach; ?> |
|
| 61 | 61 | return $this->validate($validator); |
| 62 | 62 | } |
| 63 | 63 | |
@@ -66,11 +66,11 @@ discard block |
||
| 66 | 66 | */ |
| 67 | 67 | public function initialize() |
| 68 | 68 | { |
| 69 | - <?=$mapDependents."\n"?> |
|
| 70 | - <?=$mapParents."\n"?> |
|
| 69 | + <?=$mapDependents . "\n"?> |
|
| 70 | + <?=$mapParents . "\n"?> |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | -<?php if($objTables->hasSchema()): ?> |
|
| 73 | +<?php if ($objTables->hasSchema()): ?> |
|
| 74 | 74 | /** |
| 75 | 75 | * Returns schema name where table mapped is located |
| 76 | 76 | * |
@@ -92,11 +92,11 @@ discard block |
||
| 92 | 92 | return '<?=$objTables->getName()?>'; |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | -<?php if( $objTables->hasSequences() ) : ?> |
|
| 95 | +<?php if ($objTables->hasSequences()) : ?> |
|
| 96 | 96 | public function getSequenceName() |
| 97 | 97 | { |
| 98 | -<?php if ( 1 == count($objTables->getSequences() ) ) : ?> |
|
| 99 | - <?php $seqs = $objTables->getSequences();reset($seqs);$seq = current($seqs);?> |
|
| 98 | +<?php if (1 == count($objTables->getSequences())) : ?> |
|
| 99 | + <?php $seqs = $objTables->getSequences(); reset($seqs); $seq = current($seqs); ?> |
|
| 100 | 100 | return "<?=$seq->getSequence() ?>"; |
| 101 | 101 | <?php endif ?> |
| 102 | 102 | } |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | * Allows to query a set of records that match the specified conditions |
| 107 | 107 | * |
| 108 | 108 | * @param mixed $parameters |
| 109 | - * @return \<?=$objTables->getNamespace()?>\<?=\Classes\Maker\AbstractMaker::getClassName ( $objTables->getName () )?>[] |
|
| 109 | + * @return \<?=$objTables->getNamespace()?>\<?=\Classes\Maker\AbstractMaker::getClassName($objTables->getName())?>[] |
|
| 110 | 110 | */ |
| 111 | 111 | public static function find($parameters = null) |
| 112 | 112 | { |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | * Allows to query the first record that match the specified conditions |
| 118 | 118 | * |
| 119 | 119 | * @param mixed $parameters |
| 120 | - * @return \<?=$objTables->getNamespace()?>\<?=\Classes\Maker\AbstractMaker::getClassName ( $objTables->getName () )."\n"?> |
|
| 120 | + * @return \<?=$objTables->getNamespace()?>\<?=\Classes\Maker\AbstractMaker::getClassName($objTables->getName()) . "\n"?> |
|
| 121 | 121 | */ |
| 122 | 122 | public static function findFirst($parameters = null) |
| 123 | 123 | { |
@@ -126,17 +126,17 @@ discard block |
||
| 126 | 126 | |
| 127 | 127 | |
| 128 | 128 | <?php foreach ($objTables->getColumns() as $column): ?> |
| 129 | - public function set<?=$this->getClassName ( $column->getName () )?>( $<?=$column->getName()?> ) |
|
| 129 | + public function set<?=$this->getClassName($column->getName())?>( $<?=$column->getName()?> ) |
|
| 130 | 130 | { |
| 131 | 131 | $this-><?=$column->getName()?> = $<?=$column->getName()?>; |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | /** |
| 135 | - * @return <?=$column->getType ()."\n" ?> |
|
| 135 | + * @return <?=$column->getType() . "\n" ?> |
|
| 136 | 136 | **/ |
| 137 | - public function get<?=$this->getClassName ( $column->getName () )?>() |
|
| 137 | + public function get<?=$this->getClassName($column->getName())?>() |
|
| 138 | 138 | { |
| 139 | - return (<?=$column->getType () ?>) $this-><?=$column->getName()?>; |
|
| 139 | + return (<?=$column->getType() ?>) $this-><?=$column->getName()?>; |
|
| 140 | 140 | } |
| 141 | -<?php endforeach;?> |
|
| 141 | +<?php endforeach; ?> |
|
| 142 | 142 | } |
| 143 | 143 | \ No newline at end of file |
@@ -3,28 +3,28 @@ |
||
| 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 <?=$objTables->getNamespace()?>\Peer |
| 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"?> |
|
| 15 | - * @version <?=$this->config->version."\n"?> |
|
| 12 | + * @copyright <?=$this->config->copyright . "\n"?> |
|
| 13 | + * @license <?=$this->config->license . "\n"?> |
|
| 14 | + * @link <?=$this->config->link . "\n"?> |
|
| 15 | + * @version <?=$this->config->version . "\n"?> |
|
| 16 | 16 | */ |
| 17 | 17 | |
| 18 | 18 | namespace <?=$objTables->getNamespace()?>\Peer; |
| 19 | 19 | |
| 20 | -class <?=\Classes\Maker\AbstractMaker::getClassName ( $objTables->getName () )?> extends \<?=$this->config->namespace?$this->config->namespace."\\":""?>Models\<?=$objMakeFile->getParentClass() . "\n"?> |
|
| 20 | +class <?=\Classes\Maker\AbstractMaker::getClassName($objTables->getName())?> extends \<?=$this->config->namespace ? $this->config->namespace . "\\" : ""?>Models\<?=$objMakeFile->getParentClass() . "\n"?> |
|
| 21 | 21 | { |
| 22 | 22 | /** |
| 23 | 23 | * Name of the object for static instance |
| 24 | 24 | * |
| 25 | 25 | * @var string $className |
| 26 | 26 | */ |
| 27 | - protected static $className = '<?=$objTables->getNamespace()?>\<?=$this->getClassName ( $objTables->getName () )?>'; |
|
| 27 | + protected static $className = '<?=$objTables->getNamespace()?>\<?=$this->getClassName($objTables->getName())?>'; |
|
| 28 | 28 | |
| 29 | 29 | /* @TODO Codifique aqui */ |
| 30 | 30 | } |
| 31 | 31 | \ No newline at end of file |
@@ -3,19 +3,19 @@ |
||
| 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?>\Models |
| 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"?> |
|
| 15 | - * @version <?=$this->config->version."\n"?> |
|
| 12 | + * @copyright <?=$this->config->copyright . "\n"?> |
|
| 13 | + * @license <?=$this->config->license . "\n"?> |
|
| 14 | + * @link <?=$this->config->link . "\n"?> |
|
| 15 | + * @version <?=$this->config->version . "\n"?> |
|
| 16 | 16 | */ |
| 17 | 17 | |
| 18 | -namespace <?=$this->config->namespace?$this->config->namespace."\\":""?>Models; |
|
| 18 | +namespace <?=$this->config->namespace ? $this->config->namespace . "\\" : ""?>Models; |
|
| 19 | 19 | |
| 20 | 20 | abstract class AbstractPeer |
| 21 | 21 | { |
@@ -3,20 +3,20 @@ |
||
| 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"?> |
|
| 16 | - * @version <?=$this->config->version."\n"?> |
|
| 13 | + * @copyright <?=$this->config->copyright . "\n"?> |
|
| 14 | + * @license <?=$this->config->license . "\n"?> |
|
| 15 | + * @link <?=$this->config->link . "\n"?> |
|
| 16 | + * @version <?=$this->config->version . "\n"?> |
|
| 17 | 17 | */ |
| 18 | 18 | |
| 19 | -class <?=$objTables->getNamespace()?>_<?=\Classes\Maker\AbstractMaker::getClassName ( $objTables->getName () )?> extends <?=$objTables->getNamespace()?>_Entity_<?=\Classes\Maker\AbstractMaker::getClassName ( $objTables->getName () ). "\n"?> |
|
| 19 | +class <?=$objTables->getNamespace()?>_<?=\Classes\Maker\AbstractMaker::getClassName($objTables->getName())?> extends <?=$objTables->getNamespace()?>_Entity_<?=\Classes\Maker\AbstractMaker::getClassName($objTables->getName()) . "\n"?> |
|
| 20 | 20 | { |
| 21 | 21 | /* @TODO Codifique aqui */ |
| 22 | 22 | } |
@@ -3,18 +3,18 @@ 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 | * Classe Abstract pai de todas as tabelas |
| 9 | 9 | * |
| 10 | 10 | * @package <?=$this->config->namespace?>Model |
| 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"?> |
|
| 17 | - * @version <?=$this->config->version."\n"?> |
|
| 14 | + * @copyright <?=$this->config->copyright . "\n"?> |
|
| 15 | + * @license <?=$this->config->license . "\n"?> |
|
| 16 | + * @link <?=$this->config->link . "\n"?> |
|
| 17 | + * @version <?=$this->config->version . "\n"?> |
|
| 18 | 18 | * |
| 19 | 19 | * @abstract |
| 20 | 20 | */ |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | * Zend DB Table Abstract class |
| 24 | 24 | */ |
| 25 | 25 | |
| 26 | -abstract class <?=$this->config->namespace?$this->config->namespace."_":""?>Model_TableAbstract extends Zend_Db_Table_Abstract |
|
| 26 | +abstract class <?=$this->config->namespace ? $this->config->namespace . "_" : ""?>Model_TableAbstract extends Zend_Db_Table_Abstract |
|
| 27 | 27 | { |
| 28 | 28 | /** |
| 29 | 29 | * Nome da tabela do banco de dados |
@@ -1,36 +1,36 @@ 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"?> |
|
| 17 | - * @version <?=$this->config->version."\n"?> |
|
| 14 | + * @copyright <?=$this->config->copyright . "\n"?> |
|
| 15 | + * @license <?=$this->config->license . "\n"?> |
|
| 16 | + * @link <?=$this->config->link . "\n"?> |
|
| 17 | + * @version <?=$this->config->version . "\n"?> |
|
| 18 | 18 | */ |
| 19 | 19 | |
| 20 | 20 | /** |
| 21 | 21 | * Abstract class for entity |
| 22 | 22 | */ |
| 23 | 23 | |
| 24 | -abstract class <?=$className?> extends <?=$this->config->namespace?$this->config->namespace."_":""?>Model_<?=$objMakeFile->getParentClass() . "\n"?> |
|
| 24 | +abstract class <?=$className?> extends <?=$this->config->namespace ? $this->config->namespace . "_" : ""?>Model_<?=$objMakeFile->getParentClass() . "\n"?> |
|
| 25 | 25 | { |
| 26 | 26 | |
| 27 | 27 | <?php foreach ($objTables->getColumns() as $column): ?> |
| 28 | 28 | /** |
| 29 | - * Database constraint in the column <?=$column->getName()."\n"?> |
|
| 29 | + * Database constraint in the column <?=$column->getName() . "\n"?> |
|
| 30 | 30 | * |
| 31 | 31 | */ |
| 32 | 32 | const <?=strtoupper($column->getName())?> = '<?=$objTables->getName()?>.<?=$column->getName()?>'; |
| 33 | -<?php endforeach;?> |
|
| 33 | +<?php endforeach; ?> |
|
| 34 | 34 | |
| 35 | 35 | /** |
| 36 | 36 | * Nome da tabela DbTable do model |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | * @var string |
| 39 | 39 | * @access protected |
| 40 | 40 | */ |
| 41 | - protected $_tableClass = '<?=$objTables->getNamespace()?>_DbTable_<?=\Classes\Maker\AbstractMaker::getClassName ( $objTables->getName () )?>'; |
|
| 41 | + protected $_tableClass = '<?=$objTables->getNamespace()?>_DbTable_<?=\Classes\Maker\AbstractMaker::getClassName($objTables->getName())?>'; |
|
| 42 | 42 | |
| 43 | 43 | /** |
| 44 | 44 | * @see <?=$this->config->namespace?>Model_EntityAbstract::$_columnsList |
@@ -46,17 +46,17 @@ discard block |
||
| 46 | 46 | protected $_columnsList = array( |
| 47 | 47 | <?php foreach ($objTables->getColumns() as $column): ?> |
| 48 | 48 | self::<?=strtoupper($column->getName())?> => '<?=strtolower(\Classes\Maker\AbstractMaker::getClassName($column->getName()))?>', |
| 49 | -<?php endforeach;?> |
|
| 49 | +<?php endforeach; ?> |
|
| 50 | 50 | ); |
| 51 | 51 | |
| 52 | 52 | /** |
| 53 | 53 | * @see <?=$this->config->namespace?>Model_EntityAbstract::$_filters |
| 54 | 54 | */ |
| 55 | 55 | protected $_filters = array( |
| 56 | -<?php foreach ( $objTables->getColumns () as $column ): ?> |
|
| 56 | +<?php foreach ($objTables->getColumns() as $column): ?> |
|
| 57 | 57 | <?php |
| 58 | 58 | $filters = null; |
| 59 | - switch ( ucfirst ( $column->getType () ) ) |
|
| 59 | + switch (ucfirst($column->getType())) |
|
| 60 | 60 | { |
| 61 | 61 | case 'String': |
| 62 | 62 | $filters = 'StripTags", "StringTrim'; |
@@ -67,50 +67,50 @@ discard block |
||
| 67 | 67 | case 'Date': |
| 68 | 68 | break; |
| 69 | 69 | default: |
| 70 | - $filters = ucfirst ( $column->getType () ); |
|
| 70 | + $filters = ucfirst($column->getType()); |
|
| 71 | 71 | break; |
| 72 | 72 | } |
| 73 | 73 | ?> |
| 74 | 74 | '<?=$column->getName()?>'=>array ( |
| 75 | - <?=( !empty( $filters ) ) ? "\"{$filters}\"\n" : null; ?> |
|
| 75 | + <?=( ! empty($filters)) ? "\"{$filters}\"\n" : null; ?> |
|
| 76 | 76 | ), |
| 77 | -<?php endforeach;?> |
|
| 77 | +<?php endforeach; ?> |
|
| 78 | 78 | ); |
| 79 | 79 | |
| 80 | 80 | /** |
| 81 | 81 | * @see <?=$this->config->namespace?>Model_EntityAbstract::$_validators |
| 82 | 82 | */ |
| 83 | 83 | protected $_validators= array( |
| 84 | -<?php foreach ( $objTables->getColumns () as $column ): ?> |
|
| 84 | +<?php foreach ($objTables->getColumns() as $column): ?> |
|
| 85 | 85 | <?php |
| 86 | - $validators = array (); |
|
| 86 | + $validators = array(); |
|
| 87 | 87 | |
| 88 | - $validators[] = $column->isNullable () ? "'allowEmpty' => true" : "'NotEmpty'"; |
|
| 88 | + $validators[] = $column->isNullable() ? "'allowEmpty' => true" : "'NotEmpty'"; |
|
| 89 | 89 | |
| 90 | - switch ( ucfirst ( $column->getType () ) ) |
|
| 90 | + switch (ucfirst($column->getType())) |
|
| 91 | 91 | { |
| 92 | 92 | case 'String': |
| 93 | - if ( $column->getMaxLength () ) |
|
| 93 | + if ($column->getMaxLength()) |
|
| 94 | 94 | { |
| 95 | - $validators[] = "array( 'StringLength', array( 'max' => " . $column->getMaxLength () . " ) )"; |
|
| 95 | + $validators[] = "array( 'StringLength', array( 'max' => " . $column->getMaxLength() . " ) )"; |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | break; |
| 99 | 99 | case 'Boolean': |
| 100 | 100 | break; |
| 101 | 101 | default: |
| 102 | - $name = ucfirst ( $column->getType () ); |
|
| 102 | + $name = ucfirst($column->getType()); |
|
| 103 | 103 | $validators[] = "'$name'"; |
| 104 | 104 | break; |
| 105 | 105 | } |
| 106 | - $validators = implode ( ", ", $validators )?> |
|
| 107 | - '<?= $column->getName () ?>' => array ( |
|
| 108 | - <?=( !empty( $validators ) ) ? "{$validators}\n" : null?> |
|
| 106 | + $validators = implode(", ", $validators)?> |
|
| 107 | + '<?= $column->getName() ?>' => array ( |
|
| 108 | + <?=( ! empty($validators)) ? "{$validators}\n" : null?> |
|
| 109 | 109 | ), |
| 110 | 110 | <?php endforeach; ?> |
| 111 | 111 | ); |
| 112 | 112 | |
| 113 | -<?php if( $objTables->hasPrimaryKey() ):?> |
|
| 113 | +<?php if ($objTables->hasPrimaryKey()):?> |
|
| 114 | 114 | /** |
| 115 | 115 | * Nome da Primary Key |
| 116 | 116 | * |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | */ |
| 120 | 120 | |
| 121 | 121 | protected $_primary = array( |
| 122 | - <?php foreach($objTables->getPrimarykeys() as $pks) : ?> |
|
| 122 | + <?php foreach ($objTables->getPrimarykeys() as $pks) : ?> |
|
| 123 | 123 | '<?=$pks->getName()?>', |
| 124 | 124 | <?php endforeach ?> |
| 125 | 125 | ); |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | */ |
| 134 | 134 | protected $_parent_<?=$parent['name']?>; |
| 135 | 135 | |
| 136 | -<?php endforeach;?> |
|
| 136 | +<?php endforeach; ?> |
|
| 137 | 137 | <?php foreach ($depends as $depend): ?> |
| 138 | 138 | /** |
| 139 | 139 | * Depends relation <?=\Classes\Maker\AbstractMaker::getClassName($depend['table']) . "\n"?> |
@@ -142,13 +142,13 @@ discard block |
||
| 142 | 142 | */ |
| 143 | 143 | protected $_depend_<?=$depend['name']?>; |
| 144 | 144 | |
| 145 | -<?php endforeach;?> |
|
| 145 | +<?php endforeach; ?> |
|
| 146 | 146 | <?php foreach ($objTables->getColumns() as $column): ?> |
| 147 | 147 | /** |
| 148 | 148 | * |
| 149 | - * Sets column <?=$column->getName()."\n"?> |
|
| 149 | + * Sets column <?=$column->getName() . "\n"?> |
|
| 150 | 150 | * |
| 151 | -<?php if ($column->getType()=='date'): ?> |
|
| 151 | +<?php if ($column->getType() == 'date'): ?> |
|
| 152 | 152 | * Stored in ISO 8601 format. |
| 153 | 153 | * |
| 154 | 154 | * @param string|Zend_Date $<?=$column->getName() . "\n"?> |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | */ |
| 160 | 160 | public function set<?=\Classes\Maker\AbstractMaker::getClassName($column->getName())?>($<?=$column->getName()?>) |
| 161 | 161 | { |
| 162 | -<?php switch ( $column->getType () ): |
|
| 162 | +<?php switch ($column->getType()): |
|
| 163 | 163 | case 'date': ?> |
| 164 | 164 | if (! empty($<?=$column->getName()?>)) |
| 165 | 165 | { |
@@ -198,16 +198,16 @@ discard block |
||
| 198 | 198 | /** |
| 199 | 199 | * Gets column <?=$column->getName() . "\n"?> |
| 200 | 200 | * |
| 201 | -<?php if ($column->getType()=='date'): ?> |
|
| 201 | +<?php if ($column->getType() == 'date'): ?> |
|
| 202 | 202 | * @param boolean $returnZendDate |
| 203 | 203 | * @return Zend_Date|null|string Zend_Date representation of this datetime if enabled, or ISO 8601 string if not |
| 204 | 204 | <?php else: ?> |
| 205 | 205 | * @return <?=$column->getType() . "\n"?> |
| 206 | 206 | <?php endif; ?> |
| 207 | 207 | */ |
| 208 | - public function get<?=\Classes\Maker\AbstractMaker::getClassName($column->getName())?>(<?php if ($column->getType()=='date'): ?>$returnZendDate = false <?php endif;?>) |
|
| 208 | + public function get<?=\Classes\Maker\AbstractMaker::getClassName($column->getName())?>(<?php if ($column->getType() == 'date'): ?>$returnZendDate = false <?php endif; ?>) |
|
| 209 | 209 | { |
| 210 | -<?php if ($column->getType()=='date'): ?> |
|
| 210 | +<?php if ($column->getType() == 'date'): ?> |
|
| 211 | 211 | if ($returnZendDate) |
| 212 | 212 | { |
| 213 | 213 | if ($this->_data['<?=$column->getName()?>'] === null) |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | { |
| 234 | 234 | if ($this->_parent_<?=$parent['name']?> === null) |
| 235 | 235 | { |
| 236 | - $this->_parent_<?=$parent['name']?> = $this->findParentRow('<?=$objTables->getNamespace()?>_DbTable_<?=\Classes\Maker\AbstractMaker::getClassName ($parent['table'])?>', '<?=\Classes\Maker\AbstractMaker::getClassName($parent['name'])?>'); |
|
| 236 | + $this->_parent_<?=$parent['name']?> = $this->findParentRow('<?=$objTables->getNamespace()?>_DbTable_<?=\Classes\Maker\AbstractMaker::getClassName($parent['table'])?>', '<?=\Classes\Maker\AbstractMaker::getClassName($parent['name'])?>'); |
|
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | return $this->_parent_<?=$parent['name']?>; |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | { |
| 253 | 253 | if ($this->_depend_<?=$depend['name']?> === null) |
| 254 | 254 | { |
| 255 | - $this->_depend_<?=$depend['name']?> = $this->findDependentRowset('<?=$objTables->getNamespace()?>_DbTable_<?=\Classes\Maker\AbstractMaker::getClassName ($depend['table'])?>'); |
|
| 255 | + $this->_depend_<?=$depend['name']?> = $this->findDependentRowset('<?=$objTables->getNamespace()?>_DbTable_<?=\Classes\Maker\AbstractMaker::getClassName($depend['table'])?>'); |
|
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | return $this->_depend_<?=$depend['name']?>; |