@@ -107,31 +107,31 @@ discard block |
||
| 107 | 107 | if ( $table->hasColumn ( $constrant[ "column_name" ] ) ) |
| 108 | 108 | { |
| 109 | 109 | $objConstrant = Constrant::getInstance () |
| 110 | - ->populate ( |
|
| 111 | - array ( |
|
| 112 | - 'constrant' => $constrant[ 'constraint_name' ] , |
|
| 113 | - 'schema' => $constrant[ 'foreign_schema' ] , |
|
| 114 | - 'table' => $constrant[ 'foreign_table' ] , |
|
| 115 | - 'column' => $constrant[ 'foreign_column' ] |
|
| 116 | - ) |
|
| 117 | - ); |
|
| 110 | + ->populate ( |
|
| 111 | + array ( |
|
| 112 | + 'constrant' => $constrant[ 'constraint_name' ] , |
|
| 113 | + 'schema' => $constrant[ 'foreign_schema' ] , |
|
| 114 | + 'table' => $constrant[ 'foreign_table' ] , |
|
| 115 | + 'column' => $constrant[ 'foreign_column' ] |
|
| 116 | + ) |
|
| 117 | + ); |
|
| 118 | 118 | |
| 119 | 119 | switch ( $constrant[ 'constraint_type' ] ) |
| 120 | 120 | { |
| 121 | 121 | case "FOREIGN KEY": |
| 122 | 122 | $table->getColumn ( $constrant[ "column_name" ] ) |
| 123 | - ->addRefFk ( $objConstrant ); |
|
| 123 | + ->addRefFk ( $objConstrant ); |
|
| 124 | 124 | break; |
| 125 | 125 | case"PRIMARY KEY": |
| 126 | 126 | $table->getColumn ( $constrant[ "column_name" ] ) |
| 127 | - ->setPrimaryKey ( $objConstrant ) |
|
| 128 | - ->setSequence ( |
|
| 129 | - $this->getSequence ( |
|
| 130 | - $table_name , |
|
| 131 | - $constrant[ "column_name" ], |
|
| 132 | - $schema |
|
| 133 | - ) |
|
| 134 | - ); |
|
| 127 | + ->setPrimaryKey ( $objConstrant ) |
|
| 128 | + ->setSequence ( |
|
| 129 | + $this->getSequence ( |
|
| 130 | + $table_name , |
|
| 131 | + $constrant[ "column_name" ], |
|
| 132 | + $schema |
|
| 133 | + ) |
|
| 134 | + ); |
|
| 135 | 135 | break; |
| 136 | 136 | } |
| 137 | 137 | } |
@@ -151,12 +151,12 @@ discard block |
||
| 151 | 151 | if ( $table->hasColumn ( $constrant[ "foreign_column" ] ) ) |
| 152 | 152 | { |
| 153 | 153 | $table->getColumn ( $constrant[ "foreign_column" ] ) |
| 154 | - ->createDependece ( |
|
| 155 | - $constrant[ 'constraint_name' ] , |
|
| 156 | - $constrant[ 'table_name' ] , |
|
| 157 | - $constrant[ 'column_name' ] , |
|
| 158 | - $constrant[ 'table_schema' ] |
|
| 159 | - ); |
|
| 154 | + ->createDependece ( |
|
| 155 | + $constrant[ 'constraint_name' ] , |
|
| 156 | + $constrant[ 'table_name' ] , |
|
| 157 | + $constrant[ 'column_name' ] , |
|
| 158 | + $constrant[ 'table_schema' ] |
|
| 159 | + ); |
|
| 160 | 160 | } |
| 161 | 161 | } |
| 162 | 162 | } |
@@ -191,10 +191,10 @@ discard block |
||
| 191 | 191 | ); |
| 192 | 192 | |
| 193 | 193 | $this->getTable ( $key , $schema ) |
| 194 | - ->addColumn ( $column ) |
|
| 195 | - ->setNamespace ( |
|
| 196 | - $this->config->createClassNamespace ( $this->getTable ( $key , $schema ) ) |
|
| 197 | - ); |
|
| 194 | + ->addColumn ( $column ) |
|
| 195 | + ->setNamespace ( |
|
| 196 | + $this->config->createClassNamespace ( $this->getTable ( $key , $schema ) ) |
|
| 197 | + ); |
|
| 198 | 198 | } |
| 199 | 199 | } |
| 200 | 200 | |
@@ -254,13 +254,13 @@ discard block |
||
| 254 | 254 | public function createTable ( $nameTable , $schema = 0 ) |
| 255 | 255 | { |
| 256 | 256 | $this->objDbTables[ $schema ][ trim ( $nameTable ) ] = DbTable::getInstance () |
| 257 | - ->populate ( |
|
| 258 | - array ( |
|
| 259 | - 'table' => $nameTable , |
|
| 260 | - 'schema' => $schema , |
|
| 261 | - 'database' => $this->database |
|
| 262 | - ) |
|
| 263 | - ); |
|
| 257 | + ->populate ( |
|
| 258 | + array ( |
|
| 259 | + 'table' => $nameTable , |
|
| 260 | + 'schema' => $schema , |
|
| 261 | + 'database' => $this->database |
|
| 262 | + ) |
|
| 263 | + ); |
|
| 264 | 264 | |
| 265 | 265 | return $this; |
| 266 | 266 | } |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | /** |
| 60 | 60 | * @type \Classes\Db\DbTable[][] |
| 61 | 61 | */ |
| 62 | - private $objDbTables = array (); |
|
| 62 | + private $objDbTables = array(); |
|
| 63 | 63 | |
| 64 | 64 | /** |
| 65 | 65 | * @var AbstractAdapter |
@@ -74,22 +74,22 @@ discard block |
||
| 74 | 74 | /** |
| 75 | 75 | * analisa e popula as Foreing keys, Primary keys e dependencias do banco nos objetos |
| 76 | 76 | */ |
| 77 | - protected function parseConstrants () |
|
| 77 | + protected function parseConstrants() |
|
| 78 | 78 | { |
| 79 | - foreach ( $this->getListConstrant () as $constrant ) |
|
| 79 | + foreach ($this->getListConstrant() as $constrant) |
|
| 80 | 80 | { |
| 81 | 81 | |
| 82 | - $schema = $constrant[ 'table_schema' ]; |
|
| 83 | - $table_name = $constrant [ 'table_name' ]; |
|
| 84 | - $this->populateForeignAndPrimaryKeys ( $constrant , $table_name , $schema ); |
|
| 85 | - unset( $table_name , $schema ); |
|
| 82 | + $schema = $constrant['table_schema']; |
|
| 83 | + $table_name = $constrant ['table_name']; |
|
| 84 | + $this->populateForeignAndPrimaryKeys($constrant, $table_name, $schema); |
|
| 85 | + unset($table_name, $schema); |
|
| 86 | 86 | |
| 87 | - if ( $constrant[ 'constraint_type' ] == "FOREIGN KEY" ) |
|
| 87 | + if ($constrant['constraint_type'] == "FOREIGN KEY") |
|
| 88 | 88 | { |
| 89 | - $schema = $constrant[ 'foreign_schema' ]; |
|
| 90 | - $table_name = $constrant [ 'foreign_table' ]; |
|
| 91 | - $this->populateDependece ( $constrant , $table_name , $schema ); |
|
| 92 | - unset( $table_name , $schema ); |
|
| 89 | + $schema = $constrant['foreign_schema']; |
|
| 90 | + $table_name = $constrant ['foreign_table']; |
|
| 91 | + $this->populateDependece($constrant, $table_name, $schema); |
|
| 92 | + unset($table_name, $schema); |
|
| 93 | 93 | } |
| 94 | 94 | } |
| 95 | 95 | } |
@@ -99,36 +99,36 @@ discard block |
||
| 99 | 99 | * @param string $table_name |
| 100 | 100 | * @param int $schema |
| 101 | 101 | */ |
| 102 | - private function populateForeignAndPrimaryKeys ( $constrant , $table_name , $schema = 0 ) |
|
| 102 | + private function populateForeignAndPrimaryKeys($constrant, $table_name, $schema = 0) |
|
| 103 | 103 | { |
| 104 | - if ( $this->hasTable ( $table_name , $schema ) ) |
|
| 104 | + if ($this->hasTable($table_name, $schema)) |
|
| 105 | 105 | { |
| 106 | - $table = $this->getTable ( $table_name , $schema ); |
|
| 107 | - if ( $table->hasColumn ( $constrant[ "column_name" ] ) ) |
|
| 106 | + $table = $this->getTable($table_name, $schema); |
|
| 107 | + if ($table->hasColumn($constrant["column_name"])) |
|
| 108 | 108 | { |
| 109 | - $objConstrant = Constrant::getInstance () |
|
| 110 | - ->populate ( |
|
| 111 | - array ( |
|
| 112 | - 'constrant' => $constrant[ 'constraint_name' ] , |
|
| 113 | - 'schema' => $constrant[ 'foreign_schema' ] , |
|
| 114 | - 'table' => $constrant[ 'foreign_table' ] , |
|
| 115 | - 'column' => $constrant[ 'foreign_column' ] |
|
| 109 | + $objConstrant = Constrant::getInstance() |
|
| 110 | + ->populate( |
|
| 111 | + array( |
|
| 112 | + 'constrant' => $constrant['constraint_name'], |
|
| 113 | + 'schema' => $constrant['foreign_schema'], |
|
| 114 | + 'table' => $constrant['foreign_table'], |
|
| 115 | + 'column' => $constrant['foreign_column'] |
|
| 116 | 116 | ) |
| 117 | 117 | ); |
| 118 | 118 | |
| 119 | - switch ( $constrant[ 'constraint_type' ] ) |
|
| 119 | + switch ($constrant['constraint_type']) |
|
| 120 | 120 | { |
| 121 | 121 | case "FOREIGN KEY": |
| 122 | - $table->getColumn ( $constrant[ "column_name" ] ) |
|
| 123 | - ->addRefFk ( $objConstrant ); |
|
| 122 | + $table->getColumn($constrant["column_name"]) |
|
| 123 | + ->addRefFk($objConstrant); |
|
| 124 | 124 | break; |
| 125 | 125 | case"PRIMARY KEY": |
| 126 | - $table->getColumn ( $constrant[ "column_name" ] ) |
|
| 127 | - ->setPrimaryKey ( $objConstrant ) |
|
| 128 | - ->setSequence ( |
|
| 129 | - $this->getSequence ( |
|
| 130 | - $table_name , |
|
| 131 | - $constrant[ "column_name" ], |
|
| 126 | + $table->getColumn($constrant["column_name"]) |
|
| 127 | + ->setPrimaryKey($objConstrant) |
|
| 128 | + ->setSequence( |
|
| 129 | + $this->getSequence( |
|
| 130 | + $table_name, |
|
| 131 | + $constrant["column_name"], |
|
| 132 | 132 | $schema |
| 133 | 133 | ) |
| 134 | 134 | ); |
@@ -143,19 +143,19 @@ discard block |
||
| 143 | 143 | * @param string $table_name |
| 144 | 144 | * @param int $schema |
| 145 | 145 | */ |
| 146 | - private function populateDependece ( $constrant , $table_name , $schema = 0 ) |
|
| 146 | + private function populateDependece($constrant, $table_name, $schema = 0) |
|
| 147 | 147 | { |
| 148 | - if ( $this->hasTable ( $table_name , $schema ) ) |
|
| 148 | + if ($this->hasTable($table_name, $schema)) |
|
| 149 | 149 | { |
| 150 | - $table = $this->getTable ( $table_name , $schema ); |
|
| 151 | - if ( $table->hasColumn ( $constrant[ "foreign_column" ] ) ) |
|
| 150 | + $table = $this->getTable($table_name, $schema); |
|
| 151 | + if ($table->hasColumn($constrant["foreign_column"])) |
|
| 152 | 152 | { |
| 153 | - $table->getColumn ( $constrant[ "foreign_column" ] ) |
|
| 154 | - ->createDependece ( |
|
| 155 | - $constrant[ 'constraint_name' ] , |
|
| 156 | - $constrant[ 'table_name' ] , |
|
| 157 | - $constrant[ 'column_name' ] , |
|
| 158 | - $constrant[ 'table_schema' ] |
|
| 153 | + $table->getColumn($constrant["foreign_column"]) |
|
| 154 | + ->createDependece( |
|
| 155 | + $constrant['constraint_name'], |
|
| 156 | + $constrant['table_name'], |
|
| 157 | + $constrant['column_name'], |
|
| 158 | + $constrant['table_schema'] |
|
| 159 | 159 | ); |
| 160 | 160 | } |
| 161 | 161 | } |
@@ -164,36 +164,36 @@ discard block |
||
| 164 | 164 | /** |
| 165 | 165 | * cria um Array com nome das tabelas |
| 166 | 166 | */ |
| 167 | - public function parseTables () |
|
| 167 | + public function parseTables() |
|
| 168 | 168 | { |
| 169 | - if ( $this->hasTables () ) |
|
| 169 | + if ($this->hasTables()) |
|
| 170 | 170 | { |
| 171 | - return $this->getAllTables (); |
|
| 171 | + return $this->getAllTables(); |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | - foreach ( $this->getListColumns () as $table ) |
|
| 174 | + foreach ($this->getListColumns() as $table) |
|
| 175 | 175 | { |
| 176 | - $schema = $table[ 'table_schema' ]; |
|
| 177 | - $key = $table [ 'table_name' ]; |
|
| 178 | - if ( ! $this->hasTable ( $key , $schema ) ) |
|
| 176 | + $schema = $table['table_schema']; |
|
| 177 | + $key = $table ['table_name']; |
|
| 178 | + if ( ! $this->hasTable($key, $schema)) |
|
| 179 | 179 | { |
| 180 | - $this->createTable ( $key , $schema ); |
|
| 180 | + $this->createTable($key, $schema); |
|
| 181 | 181 | } |
| 182 | 182 | |
| 183 | - $column = Column::getInstance () |
|
| 184 | - ->populate ( |
|
| 185 | - array ( |
|
| 186 | - 'name' => $table [ 'column_name' ] , |
|
| 187 | - 'type' => $this->convertTypeToPhp ( $table[ 'data_type' ] ) , |
|
| 188 | - 'nullable' => ( $table[ 'is_nullable' ] == 'YES' ) , |
|
| 189 | - 'max_length' => $table[ 'max_length' ] |
|
| 183 | + $column = Column::getInstance() |
|
| 184 | + ->populate( |
|
| 185 | + array( |
|
| 186 | + 'name' => $table ['column_name'], |
|
| 187 | + 'type' => $this->convertTypeToPhp($table['data_type']), |
|
| 188 | + 'nullable' => ($table['is_nullable'] == 'YES'), |
|
| 189 | + 'max_length' => $table['max_length'] |
|
| 190 | 190 | ) |
| 191 | 191 | ); |
| 192 | 192 | |
| 193 | - $this->getTable ( $key , $schema ) |
|
| 194 | - ->addColumn ( $column ) |
|
| 195 | - ->setNamespace ( |
|
| 196 | - $this->config->createClassNamespace ( $this->getTable ( $key , $schema ) ) |
|
| 193 | + $this->getTable($key, $schema) |
|
| 194 | + ->addColumn($column) |
|
| 195 | + ->setNamespace( |
|
| 196 | + $this->config->createClassNamespace($this->getTable($key, $schema)) |
|
| 197 | 197 | ); |
| 198 | 198 | } |
| 199 | 199 | } |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | * |
| 204 | 204 | * @return int |
| 205 | 205 | */ |
| 206 | - abstract public function getTotalTables (); |
|
| 206 | + abstract public function getTotalTables(); |
|
| 207 | 207 | |
| 208 | 208 | /** |
| 209 | 209 | * Retorna o Nome da Sequence da tabela |
@@ -213,23 +213,23 @@ discard block |
||
| 213 | 213 | * |
| 214 | 214 | * @return string |
| 215 | 215 | */ |
| 216 | - abstract public function getSequence ( $table , $column, $schema=0 ); |
|
| 216 | + abstract public function getSequence($table, $column, $schema = 0); |
|
| 217 | 217 | |
| 218 | 218 | /** |
| 219 | 219 | * @return array |
| 220 | 220 | */ |
| 221 | - abstract public function getListConstrant (); |
|
| 221 | + abstract public function getListConstrant(); |
|
| 222 | 222 | |
| 223 | 223 | /** |
| 224 | 224 | * @param string $str |
| 225 | 225 | * |
| 226 | 226 | * @return string |
| 227 | 227 | */ |
| 228 | - protected function convertTypeToPhp ( $str ) |
|
| 228 | + protected function convertTypeToPhp($str) |
|
| 229 | 229 | { |
| 230 | - if ( isset( $this->dataTypes[ $str ] ) ) |
|
| 230 | + if (isset($this->dataTypes[$str])) |
|
| 231 | 231 | { |
| 232 | - return $this->dataTypes[ $str ]; |
|
| 232 | + return $this->dataTypes[$str]; |
|
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | return 'string'; |
@@ -238,12 +238,12 @@ discard block |
||
| 238 | 238 | /** |
| 239 | 239 | * @return string |
| 240 | 240 | */ |
| 241 | - abstract public function getPDOString (); |
|
| 241 | + abstract public function getPDOString(); |
|
| 242 | 242 | |
| 243 | 243 | /** |
| 244 | 244 | * @return string |
| 245 | 245 | */ |
| 246 | - abstract public function getPDOSocketString (); |
|
| 246 | + abstract public function getPDOSocketString(); |
|
| 247 | 247 | |
| 248 | 248 | /** |
| 249 | 249 | * @param $nameTable |
@@ -251,13 +251,13 @@ discard block |
||
| 251 | 251 | * |
| 252 | 252 | * @return \Classes\Db\DbTable |
| 253 | 253 | */ |
| 254 | - public function createTable ( $nameTable , $schema = 0 ) |
|
| 254 | + public function createTable($nameTable, $schema = 0) |
|
| 255 | 255 | { |
| 256 | - $this->objDbTables[ $schema ][ trim ( $nameTable ) ] = DbTable::getInstance () |
|
| 257 | - ->populate ( |
|
| 258 | - array ( |
|
| 259 | - 'table' => $nameTable , |
|
| 260 | - 'schema' => $schema , |
|
| 256 | + $this->objDbTables[$schema][trim($nameTable)] = DbTable::getInstance() |
|
| 257 | + ->populate( |
|
| 258 | + array( |
|
| 259 | + 'table' => $nameTable, |
|
| 260 | + 'schema' => $schema, |
|
| 261 | 261 | 'database' => $this->database |
| 262 | 262 | ) |
| 263 | 263 | ); |
@@ -270,24 +270,24 @@ discard block |
||
| 270 | 270 | * |
| 271 | 271 | * @return \Classes\Db\DbTable[] |
| 272 | 272 | */ |
| 273 | - public function getTables ( $schema = 0 ) |
|
| 273 | + public function getTables($schema = 0) |
|
| 274 | 274 | { |
| 275 | - if ( ! isset( $this->objDbTables[ $schema ] ) ) |
|
| 275 | + if ( ! isset($this->objDbTables[$schema])) |
|
| 276 | 276 | { |
| 277 | - return array (); |
|
| 277 | + return array(); |
|
| 278 | 278 | } |
| 279 | 279 | |
| 280 | - return $this->objDbTables[ $schema ]; |
|
| 280 | + return $this->objDbTables[$schema]; |
|
| 281 | 281 | } |
| 282 | 282 | |
| 283 | - public function getAllTables () |
|
| 283 | + public function getAllTables() |
|
| 284 | 284 | { |
| 285 | 285 | return $this->objDbTables; |
| 286 | 286 | } |
| 287 | 287 | |
| 288 | - public function hasTables () |
|
| 288 | + public function hasTables() |
|
| 289 | 289 | { |
| 290 | - return ! empty( $this->objDbTables ); |
|
| 290 | + return ! empty($this->objDbTables); |
|
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | /** |
@@ -297,9 +297,9 @@ discard block |
||
| 297 | 297 | * |
| 298 | 298 | * @return \Classes\Db\DbTable |
| 299 | 299 | */ |
| 300 | - public function getTable ( $nameTable , $schema = 0 ) |
|
| 300 | + public function getTable($nameTable, $schema = 0) |
|
| 301 | 301 | { |
| 302 | - return $this->objDbTables[ $schema ][ trim ( $nameTable ) ]; |
|
| 302 | + return $this->objDbTables[$schema][trim($nameTable)]; |
|
| 303 | 303 | } |
| 304 | 304 | |
| 305 | 305 | /** |
@@ -308,9 +308,9 @@ discard block |
||
| 308 | 308 | * |
| 309 | 309 | * @return bool |
| 310 | 310 | */ |
| 311 | - public function hasTable ( $nameTable , $schema = 0 ) |
|
| 311 | + public function hasTable($nameTable, $schema = 0) |
|
| 312 | 312 | { |
| 313 | - return isset( $this->objDbTables[ $schema ][ trim ( $nameTable ) ] ); |
|
| 313 | + return isset($this->objDbTables[$schema][trim($nameTable)]); |
|
| 314 | 314 | } |
| 315 | 315 | |
| 316 | 316 | /** |
@@ -318,64 +318,64 @@ discard block |
||
| 318 | 318 | * |
| 319 | 319 | * @return array[] |
| 320 | 320 | */ |
| 321 | - abstract public function getListColumns (); |
|
| 321 | + abstract public function getListColumns(); |
|
| 322 | 322 | |
| 323 | 323 | /** |
| 324 | 324 | * Retorna um Array com nome das tabelas |
| 325 | 325 | * |
| 326 | 326 | * @return string[] |
| 327 | 327 | */ |
| 328 | - abstract public function getListNameTable (); |
|
| 328 | + abstract public function getListNameTable(); |
|
| 329 | 329 | |
| 330 | 330 | /** |
| 331 | 331 | * @param \Classes\AdapterConfig\AbstractAdapter $adapterConfig |
| 332 | 332 | */ |
| 333 | - public function __construct ( AbstractAdapter $adapterConfig ) |
|
| 333 | + public function __construct(AbstractAdapter $adapterConfig) |
|
| 334 | 334 | { |
| 335 | 335 | $this->config = $adapterConfig; |
| 336 | - $this->host = $adapterConfig->getHost (); |
|
| 337 | - $this->database = $adapterConfig->getDatabase (); |
|
| 338 | - $this->port = $adapterConfig->hasPort () ? $adapterConfig->getPort () |
|
| 336 | + $this->host = $adapterConfig->getHost(); |
|
| 337 | + $this->database = $adapterConfig->getDatabase(); |
|
| 338 | + $this->port = $adapterConfig->hasPort() ? $adapterConfig->getPort() |
|
| 339 | 339 | : $this->port; |
| 340 | - $this->username = $adapterConfig->getUser (); |
|
| 341 | - $this->password = $adapterConfig->getPassword (); |
|
| 342 | - $this->socket = $adapterConfig->getSocket (); |
|
| 340 | + $this->username = $adapterConfig->getUser(); |
|
| 341 | + $this->password = $adapterConfig->getPassword(); |
|
| 342 | + $this->socket = $adapterConfig->getSocket(); |
|
| 343 | 343 | |
| 344 | 344 | } |
| 345 | 345 | |
| 346 | 346 | /** |
| 347 | 347 | * Executa as consultas do banco de dados |
| 348 | 348 | */ |
| 349 | - public function runDatabase () |
|
| 349 | + public function runDatabase() |
|
| 350 | 350 | { |
| 351 | - $this->parseTables (); |
|
| 352 | - $this->parseConstrants (); |
|
| 351 | + $this->parseTables(); |
|
| 352 | + $this->parseConstrants(); |
|
| 353 | 353 | } |
| 354 | 354 | |
| 355 | 355 | /** |
| 356 | 356 | * |
| 357 | 357 | * @return \PDO |
| 358 | 358 | */ |
| 359 | - public function getPDO () |
|
| 359 | + public function getPDO() |
|
| 360 | 360 | { |
| 361 | - if ( is_null ( $this->_pdo ) ) |
|
| 361 | + if (is_null($this->_pdo)) |
|
| 362 | 362 | { |
| 363 | - if ( ! empty( $this->socket ) ) |
|
| 363 | + if ( ! empty($this->socket)) |
|
| 364 | 364 | { |
| 365 | - $pdoString = $this->getPDOSocketString (); |
|
| 365 | + $pdoString = $this->getPDOSocketString(); |
|
| 366 | 366 | } else |
| 367 | 367 | { |
| 368 | - $pdoString = $this->getPDOString (); |
|
| 368 | + $pdoString = $this->getPDOString(); |
|
| 369 | 369 | } |
| 370 | 370 | |
| 371 | 371 | try |
| 372 | 372 | { |
| 373 | - $this->_pdo = new \PDO ( |
|
| 374 | - $pdoString , $this->username , $this->password |
|
| 373 | + $this->_pdo = new \PDO( |
|
| 374 | + $pdoString, $this->username, $this->password |
|
| 375 | 375 | ); |
| 376 | - } catch ( \Exception $e ) |
|
| 376 | + } catch (\Exception $e) |
|
| 377 | 377 | { |
| 378 | - die ( "pdo error: " . $e->getMessage () . "\n" ); |
|
| 378 | + die ("pdo error: " . $e->getMessage() . "\n"); |
|
| 379 | 379 | } |
| 380 | 380 | } |
| 381 | 381 | |
@@ -14,68 +14,68 @@ discard block |
||
| 14 | 14 | abstract class AbstractAdapter |
| 15 | 15 | { |
| 16 | 16 | |
| 17 | - protected $arrConfig = array ( |
|
| 17 | + protected $arrConfig = array( |
|
| 18 | 18 | ############################# DATABASE |
| 19 | 19 | //Driver do banco de dados |
| 20 | - 'driver' => null , |
|
| 20 | + 'driver' => null, |
|
| 21 | 21 | //Nome do banco de dados |
| 22 | - 'database' => null , |
|
| 22 | + 'database' => null, |
|
| 23 | 23 | //Host do banco |
| 24 | - 'host' => 'localhost' , |
|
| 24 | + 'host' => 'localhost', |
|
| 25 | 25 | //Port do banco |
| 26 | - 'port' => '' , |
|
| 26 | + 'port' => '', |
|
| 27 | 27 | //usuario do banco |
| 28 | - 'username' => null , |
|
| 28 | + 'username' => null, |
|
| 29 | 29 | //senha do banco |
| 30 | - 'password' => null , |
|
| 30 | + 'password' => null, |
|
| 31 | 31 | // lista de schemas do banco de dados |
| 32 | - 'schema' => array () , |
|
| 32 | + 'schema' => array(), |
|
| 33 | 33 | |
| 34 | - 'socket' => null , |
|
| 34 | + 'socket' => null, |
|
| 35 | 35 | |
| 36 | 36 | ########################### DOCS |
| 37 | 37 | // autor que gerou o script |
| 38 | - 'author' => "Pedro" , |
|
| 39 | - 'license' => "New BSD License" , |
|
| 40 | - 'copyright' => "ORM Generator - Pedro151" , |
|
| 41 | - 'link' => 'https://github.com/pedro151/orm-generator' , |
|
| 38 | + 'author' => "Pedro", |
|
| 39 | + 'license' => "New BSD License", |
|
| 40 | + 'copyright' => "ORM Generator - Pedro151", |
|
| 41 | + 'link' => 'https://github.com/pedro151/orm-generator', |
|
| 42 | 42 | // data que foi gerado o script |
| 43 | - 'last_modify' => null , |
|
| 43 | + 'last_modify' => null, |
|
| 44 | 44 | |
| 45 | 45 | ########################## Ambiente/Arquivos |
| 46 | 46 | |
| 47 | 47 | // Nome do framework para o adapter |
| 48 | - 'framework' => null , |
|
| 48 | + 'framework' => null, |
|
| 49 | 49 | // namespace das classes |
| 50 | - 'namespace' => "" , |
|
| 50 | + 'namespace' => "", |
|
| 51 | 51 | // caminho onde os arquivos devem ser criados |
| 52 | - 'path' => 'models' , |
|
| 52 | + 'path' => 'models', |
|
| 53 | 53 | // flag para gerar pasta com o nome do driver do banco de dados |
| 54 | - 'folder-database' => 0 , |
|
| 54 | + 'folder-database' => 0, |
|
| 55 | 55 | |
| 56 | 56 | ############################## Comandos adicionais |
| 57 | 57 | //flag para mostrar o status da execução ao termino do processo |
| 58 | - 'status' => false , |
|
| 58 | + 'status' => false, |
|
| 59 | 59 | // flags para criar todas as tabelas ou nao |
| 60 | - 'allTables' => true , |
|
| 60 | + 'allTables' => true, |
|
| 61 | 61 | //Lista de tabelas a serem ignoradas |
| 62 | - 'ignoreTable' => array () , |
|
| 62 | + 'ignoreTable' => array(), |
|
| 63 | 63 | ); |
| 64 | 64 | |
| 65 | 65 | /** |
| 66 | 66 | * @var string[] um array com todos os campos obrigatorios |
| 67 | 67 | */ |
| 68 | - protected $attRequered = array ( |
|
| 69 | - 'driver' => true , |
|
| 70 | - 'database' => true , |
|
| 71 | - 'host' => true , |
|
| 72 | - 'username' => true , |
|
| 68 | + protected $attRequered = array( |
|
| 69 | + 'driver' => true, |
|
| 70 | + 'database' => true, |
|
| 71 | + 'host' => true, |
|
| 72 | + 'username' => true, |
|
| 73 | 73 | 'path' => true |
| 74 | 74 | ); |
| 75 | 75 | |
| 76 | - protected $arrFunc = array (); |
|
| 76 | + protected $arrFunc = array(); |
|
| 77 | 77 | |
| 78 | - private $framworkFiles = array (); |
|
| 78 | + private $framworkFiles = array(); |
|
| 79 | 79 | |
| 80 | 80 | const SEPARETOR = ""; |
| 81 | 81 | |
@@ -84,9 +84,9 @@ discard block |
||
| 84 | 84 | * |
| 85 | 85 | * @return bool |
| 86 | 86 | */ |
| 87 | - protected function checkConfig () |
|
| 87 | + protected function checkConfig() |
|
| 88 | 88 | { |
| 89 | - if ( array_diff_key ( $this->attRequered , array_filter ( $this->arrConfig ) ) ) |
|
| 89 | + if (array_diff_key($this->attRequered, array_filter($this->arrConfig))) |
|
| 90 | 90 | { |
| 91 | 91 | return false; |
| 92 | 92 | } |
@@ -99,33 +99,33 @@ discard block |
||
| 99 | 99 | * |
| 100 | 100 | * @return array |
| 101 | 101 | */ |
| 102 | - abstract protected function getParams (); |
|
| 102 | + abstract protected function getParams(); |
|
| 103 | 103 | |
| 104 | 104 | /** |
| 105 | 105 | * Popula as config do generater com as configuraçoes do framework |
| 106 | 106 | * |
| 107 | 107 | * @return mixed |
| 108 | 108 | */ |
| 109 | - abstract protected function parseFrameworkConfig (); |
|
| 109 | + abstract protected function parseFrameworkConfig(); |
|
| 110 | 110 | |
| 111 | 111 | /** |
| 112 | 112 | * Cria Instancias dos arquivos que devem ser gerados |
| 113 | 113 | * |
| 114 | 114 | * @return \Classes\AdapterMakerFile\AbstractAdapter[] |
| 115 | 115 | */ |
| 116 | - abstract public function getMakeFileInstances (); |
|
| 116 | + abstract public function getMakeFileInstances(); |
|
| 117 | 117 | |
| 118 | - abstract protected function init (); |
|
| 118 | + abstract protected function init(); |
|
| 119 | 119 | |
| 120 | 120 | /** |
| 121 | 121 | * retorna a base do Namespace |
| 122 | 122 | * |
| 123 | 123 | * @return array |
| 124 | 124 | */ |
| 125 | - protected function getBaseNamespace () |
|
| 125 | + protected function getBaseNamespace() |
|
| 126 | 126 | { |
| 127 | - return array ( |
|
| 128 | - $this->arrConfig[ 'namespace' ] , |
|
| 127 | + return array( |
|
| 128 | + $this->arrConfig['namespace'], |
|
| 129 | 129 | 'Model' |
| 130 | 130 | ); |
| 131 | 131 | } |
@@ -136,44 +136,44 @@ discard block |
||
| 136 | 136 | * @return mixed |
| 137 | 137 | */ |
| 138 | 138 | |
| 139 | - public function createClassNamespace ( $table ) |
|
| 139 | + public function createClassNamespace($table) |
|
| 140 | 140 | { |
| 141 | - $arrNames = $this->getBaseNamespace (); |
|
| 141 | + $arrNames = $this->getBaseNamespace(); |
|
| 142 | 142 | |
| 143 | - if ( isset( $this->arrConfig[ 'folder-database' ] ) |
|
| 144 | - && $this->arrConfig[ 'folder-database' ] |
|
| 143 | + if (isset($this->arrConfig['folder-database']) |
|
| 144 | + && $this->arrConfig['folder-database'] |
|
| 145 | 145 | ) |
| 146 | 146 | { |
| 147 | - $arrNames[] = AbstractMaker::getClassName ( $this->arrConfig[ 'driver' ] ); |
|
| 147 | + $arrNames[] = AbstractMaker::getClassName($this->arrConfig['driver']); |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | - if ( $table->hasSchema () ) |
|
| 150 | + if ($table->hasSchema()) |
|
| 151 | 151 | { |
| 152 | - $arrNames[] = AbstractMaker::getClassName ( $table->getSchema () ); |
|
| 152 | + $arrNames[] = AbstractMaker::getClassName($table->getSchema()); |
|
| 153 | 153 | } else |
| 154 | 154 | { |
| 155 | - $arrNames[] = AbstractMaker::getClassName ( $table->getDatabase () ); |
|
| 155 | + $arrNames[] = AbstractMaker::getClassName($table->getDatabase()); |
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | - return implode ( static::SEPARETOR , array_filter ( $arrNames ) ); |
|
| 158 | + return implode(static::SEPARETOR, array_filter($arrNames)); |
|
| 159 | 159 | } |
| 160 | 160 | |
| 161 | - public function __construct ( $array ) |
|
| 161 | + public function __construct($array) |
|
| 162 | 162 | { |
| 163 | - $array += array ( |
|
| 164 | - 'author' => ucfirst ( get_current_user () ) , |
|
| 165 | - 'last_modify' => date ( "d-m-Y H:i:s." ) |
|
| 163 | + $array += array( |
|
| 164 | + 'author' => ucfirst(get_current_user()), |
|
| 165 | + 'last_modify' => date("d-m-Y H:i:s.") |
|
| 166 | 166 | ); |
| 167 | 167 | |
| 168 | - $this->setFrameworkFiles ( $array ); |
|
| 169 | - $this->parseFrameworkConfig (); |
|
| 170 | - $this->setParams ( $this->getParams () ); |
|
| 171 | - $this->setParams ( $array ); |
|
| 172 | - $this->init (); |
|
| 173 | - if ( ! $this->isValid () ) |
|
| 168 | + $this->setFrameworkFiles($array); |
|
| 169 | + $this->parseFrameworkConfig(); |
|
| 170 | + $this->setParams($this->getParams()); |
|
| 171 | + $this->setParams($array); |
|
| 172 | + $this->init(); |
|
| 173 | + if ( ! $this->isValid()) |
|
| 174 | 174 | { |
| 175 | - $var = array_diff_key ( $this->attRequered , array_filter ( $this->arrConfig ) ); |
|
| 176 | - throw new Exception( $var ); |
|
| 175 | + $var = array_diff_key($this->attRequered, array_filter($this->arrConfig)); |
|
| 176 | + throw new Exception($var); |
|
| 177 | 177 | } |
| 178 | 178 | } |
| 179 | 179 | |
@@ -182,47 +182,47 @@ discard block |
||
| 182 | 182 | * |
| 183 | 183 | * @param $array |
| 184 | 184 | */ |
| 185 | - public function setFrameworkFiles ( $array ) |
|
| 185 | + public function setFrameworkFiles($array) |
|
| 186 | 186 | { |
| 187 | - $this->framworkFiles[ 'library' ] = isset( $array[ 'framework-path-library' ] ) |
|
| 188 | - ? $array[ 'framework-path-library' ] |
|
| 187 | + $this->framworkFiles['library'] = isset($array['framework-path-library']) |
|
| 188 | + ? $array['framework-path-library'] |
|
| 189 | 189 | : null; |
| 190 | 190 | |
| 191 | - $this->framworkFiles[ 'ini' ] = isset( $array[ 'framework-ini' ] ) |
|
| 192 | - ? $array[ 'framework-ini' ] |
|
| 191 | + $this->framworkFiles['ini'] = isset($array['framework-ini']) |
|
| 192 | + ? $array['framework-ini'] |
|
| 193 | 193 | : null; |
| 194 | 194 | |
| 195 | - $this->framworkFiles[ 'environment' ] = isset( $array[ 'environment' ] ) |
|
| 196 | - ? $array[ 'environment' ] |
|
| 195 | + $this->framworkFiles['environment'] = isset($array['environment']) |
|
| 196 | + ? $array['environment'] |
|
| 197 | 197 | : 'production'; |
| 198 | 198 | |
| 199 | 199 | } |
| 200 | 200 | |
| 201 | - protected function isValidFrameworkFiles () |
|
| 201 | + protected function isValidFrameworkFiles() |
|
| 202 | 202 | { |
| 203 | - if ( ! is_file ( $this->framworkFiles[ 'ini' ] ) ) |
|
| 203 | + if ( ! is_file($this->framworkFiles['ini'])) |
|
| 204 | 204 | { |
| 205 | 205 | return false; |
| 206 | 206 | } |
| 207 | 207 | |
| 208 | - if ( ! is_dir ( $this->framworkFiles[ 'library' ] ) ) |
|
| 208 | + if ( ! is_dir($this->framworkFiles['library'])) |
|
| 209 | 209 | { |
| 210 | 210 | return false; |
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | |
| 214 | - if ( ! isset ( $this->framworkFiles[ 'environment' ] ) |
|
| 215 | - or empty( $this->framworkFiles[ 'environment' ] ) |
|
| 214 | + if ( ! isset ($this->framworkFiles['environment']) |
|
| 215 | + or empty($this->framworkFiles['environment']) |
|
| 216 | 216 | ) |
| 217 | 217 | { |
| 218 | 218 | return false; |
| 219 | 219 | } |
| 220 | - set_include_path ( |
|
| 221 | - implode ( |
|
| 222 | - PATH_SEPARATOR , |
|
| 223 | - array ( |
|
| 224 | - realpath ( $this->framworkFiles[ 'library' ] ) , |
|
| 225 | - get_include_path () , |
|
| 220 | + set_include_path( |
|
| 221 | + implode( |
|
| 222 | + PATH_SEPARATOR, |
|
| 223 | + array( |
|
| 224 | + realpath($this->framworkFiles['library']), |
|
| 225 | + get_include_path(), |
|
| 226 | 226 | ) |
| 227 | 227 | ) |
| 228 | 228 | ); |
@@ -230,120 +230,120 @@ discard block |
||
| 230 | 230 | return true; |
| 231 | 231 | } |
| 232 | 232 | |
| 233 | - protected function getFrameworkIni () |
|
| 233 | + protected function getFrameworkIni() |
|
| 234 | 234 | { |
| 235 | - return $this->framworkFiles[ 'ini' ]; |
|
| 235 | + return $this->framworkFiles['ini']; |
|
| 236 | 236 | } |
| 237 | 237 | |
| 238 | - protected function getEnvironment () |
|
| 238 | + protected function getEnvironment() |
|
| 239 | 239 | { |
| 240 | - return $this->framworkFiles[ 'environment' ]; |
|
| 240 | + return $this->framworkFiles['environment']; |
|
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | /** |
| 244 | 244 | * Popula as variaveis de acordo com o arquivo de configuração do seu framework |
| 245 | 245 | */ |
| 246 | - protected function isValid () |
|
| 246 | + protected function isValid() |
|
| 247 | 247 | { |
| 248 | - return $this->checkConfig (); |
|
| 248 | + return $this->checkConfig(); |
|
| 249 | 249 | } |
| 250 | 250 | |
| 251 | - private function setParams ( $array ) |
|
| 251 | + private function setParams($array) |
|
| 252 | 252 | { |
| 253 | - if ( count ( $array ) > 0 ) |
|
| 253 | + if (count($array) > 0) |
|
| 254 | 254 | { |
| 255 | - $this->arrConfig = array_filter ( $array ) + $this->arrConfig; |
|
| 255 | + $this->arrConfig = array_filter($array) + $this->arrConfig; |
|
| 256 | 256 | } |
| 257 | 257 | } |
| 258 | 258 | |
| 259 | 259 | /** |
| 260 | 260 | * @return string |
| 261 | 261 | */ |
| 262 | - public function getDatabase () |
|
| 262 | + public function getDatabase() |
|
| 263 | 263 | { |
| 264 | - return $this->arrConfig[ 'database' ]; |
|
| 264 | + return $this->arrConfig['database']; |
|
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | /** |
| 268 | 268 | * @return bool |
| 269 | 269 | */ |
| 270 | - public function hasSchemas () |
|
| 270 | + public function hasSchemas() |
|
| 271 | 271 | { |
| 272 | - return ! empty ( $this->arrConfig[ 'schema' ] ); |
|
| 272 | + return ! empty ($this->arrConfig['schema']); |
|
| 273 | 273 | } |
| 274 | 274 | |
| 275 | 275 | /** |
| 276 | 276 | * @return string[] |
| 277 | 277 | */ |
| 278 | - public function getSchemas () |
|
| 278 | + public function getSchemas() |
|
| 279 | 279 | { |
| 280 | - if ( is_string ( $this->arrConfig[ 'schema' ] ) ) |
|
| 280 | + if (is_string($this->arrConfig['schema'])) |
|
| 281 | 281 | { |
| 282 | - return array ( $this->arrConfig[ 'schema' ] ); |
|
| 282 | + return array($this->arrConfig['schema']); |
|
| 283 | 283 | } |
| 284 | 284 | |
| 285 | - return $this->arrConfig[ 'schema' ]; |
|
| 285 | + return $this->arrConfig['schema']; |
|
| 286 | 286 | } |
| 287 | 287 | |
| 288 | - public function setSchema ( $schema ) |
|
| 288 | + public function setSchema($schema) |
|
| 289 | 289 | { |
| 290 | - $this->arrConfig[ 'schema' ] = $schema; |
|
| 290 | + $this->arrConfig['schema'] = $schema; |
|
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | /** |
| 294 | 294 | * @return string |
| 295 | 295 | */ |
| 296 | - public function getHost () |
|
| 296 | + public function getHost() |
|
| 297 | 297 | { |
| 298 | - return $this->arrConfig[ 'host' ]; |
|
| 298 | + return $this->arrConfig['host']; |
|
| 299 | 299 | } |
| 300 | 300 | |
| 301 | 301 | /** |
| 302 | 302 | * @return int |
| 303 | 303 | */ |
| 304 | - public function getPort () |
|
| 304 | + public function getPort() |
|
| 305 | 305 | { |
| 306 | - return $this->arrConfig[ 'port' ]; |
|
| 306 | + return $this->arrConfig['port']; |
|
| 307 | 307 | } |
| 308 | 308 | |
| 309 | 309 | /** |
| 310 | 310 | * @return boolean |
| 311 | 311 | */ |
| 312 | - public function hasPort () |
|
| 312 | + public function hasPort() |
|
| 313 | 313 | { |
| 314 | - return ! empty( $this->arrConfig[ 'port' ] ); |
|
| 314 | + return ! empty($this->arrConfig['port']); |
|
| 315 | 315 | } |
| 316 | 316 | |
| 317 | 317 | /** |
| 318 | 318 | * @return string |
| 319 | 319 | */ |
| 320 | - public function getSocket () |
|
| 320 | + public function getSocket() |
|
| 321 | 321 | { |
| 322 | - return $this->arrConfig[ 'socket' ]; |
|
| 322 | + return $this->arrConfig['socket']; |
|
| 323 | 323 | } |
| 324 | 324 | |
| 325 | 325 | /** |
| 326 | 326 | * @return string |
| 327 | 327 | */ |
| 328 | - public function getUser () |
|
| 328 | + public function getUser() |
|
| 329 | 329 | { |
| 330 | - return $this->arrConfig[ 'username' ]; |
|
| 330 | + return $this->arrConfig['username']; |
|
| 331 | 331 | } |
| 332 | 332 | |
| 333 | 333 | /** |
| 334 | 334 | * @return string |
| 335 | 335 | */ |
| 336 | - public function getPassword () |
|
| 336 | + public function getPassword() |
|
| 337 | 337 | { |
| 338 | - return $this->arrConfig[ 'password' ]; |
|
| 338 | + return $this->arrConfig['password']; |
|
| 339 | 339 | } |
| 340 | 340 | |
| 341 | 341 | /** |
| 342 | 342 | * @return bool |
| 343 | 343 | */ |
| 344 | - public function isStatusEnabled () |
|
| 344 | + public function isStatusEnabled() |
|
| 345 | 345 | { |
| 346 | - return (bool) $this->arrConfig[ 'status' ]; |
|
| 346 | + return (bool) $this->arrConfig['status']; |
|
| 347 | 347 | } |
| 348 | 348 | |
| 349 | 349 | /** |
@@ -351,23 +351,23 @@ discard block |
||
| 351 | 351 | * |
| 352 | 352 | * @return string |
| 353 | 353 | */ |
| 354 | - public function __get ( $str ) |
|
| 354 | + public function __get($str) |
|
| 355 | 355 | { |
| 356 | - $arr = array ( |
|
| 357 | - 'namespace' , |
|
| 358 | - 'framework' , |
|
| 359 | - 'author' , |
|
| 360 | - 'license' , |
|
| 361 | - 'copyright' , |
|
| 362 | - 'link' , |
|
| 363 | - 'last_modify' , |
|
| 364 | - 'path' , |
|
| 356 | + $arr = array( |
|
| 357 | + 'namespace', |
|
| 358 | + 'framework', |
|
| 359 | + 'author', |
|
| 360 | + 'license', |
|
| 361 | + 'copyright', |
|
| 362 | + 'link', |
|
| 363 | + 'last_modify', |
|
| 364 | + 'path', |
|
| 365 | 365 | 'folder-database' |
| 366 | 366 | ); |
| 367 | 367 | |
| 368 | - if ( in_array ( $str , $arr ) ) |
|
| 368 | + if (in_array($str, $arr)) |
|
| 369 | 369 | { |
| 370 | - return $this->arrConfig[ strtolower ( $str ) ]; |
|
| 370 | + return $this->arrConfig[strtolower($str)]; |
|
| 371 | 371 | } |
| 372 | 372 | |
| 373 | 373 | 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,50 +31,50 @@ discard block |
||
| 31 | 31 | * |
| 32 | 32 | * @return array |
| 33 | 33 | */ |
| 34 | - protected function getParams () |
|
| 34 | + protected function getParams() |
|
| 35 | 35 | { |
| 36 | - if ( ! $this->config or ! $this->isValidFrameworkFiles () ) |
|
| 36 | + if ( ! $this->config or ! $this->isValidFrameworkFiles()) |
|
| 37 | 37 | { |
| 38 | - return array (); |
|
| 38 | + return array(); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - return array ( |
|
| 41 | + return array( |
|
| 42 | 42 | //Driver do banco de dados |
| 43 | - 'driver' => $this->config[ 'adapter' ] , |
|
| 43 | + 'driver' => $this->config['adapter'], |
|
| 44 | 44 | //Nome do banco de dados |
| 45 | - 'database' => $this->config[ 'params' ][ 'dbname' ] , |
|
| 45 | + 'database' => $this->config['params']['dbname'], |
|
| 46 | 46 | //Host do banco |
| 47 | - 'host' => $this->config[ 'params' ][ 'host' ] , |
|
| 47 | + 'host' => $this->config['params']['host'], |
|
| 48 | 48 | //Port do banco |
| 49 | - 'port' => isset( $this->config[ 'params' ][ 'port' ] ) |
|
| 50 | - ? $this->config[ 'params' ][ 'port' ] : '' , |
|
| 49 | + 'port' => isset($this->config['params']['port']) |
|
| 50 | + ? $this->config['params']['port'] : '', |
|
| 51 | 51 | //usuario do banco |
| 52 | - 'username' => $this->config[ 'params' ][ 'username' ] , |
|
| 52 | + 'username' => $this->config['params']['username'], |
|
| 53 | 53 | //senha do banco |
| 54 | - 'password' => $this->config[ 'params' ][ 'password' ] , |
|
| 54 | + 'password' => $this->config['params']['password'], |
|
| 55 | 55 | ); |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - protected function parseFrameworkConfig () |
|
| 58 | + protected function parseFrameworkConfig() |
|
| 59 | 59 | { |
| 60 | - if ( ! $this->isValidFrameworkFiles () ) |
|
| 60 | + if ( ! $this->isValidFrameworkFiles()) |
|
| 61 | 61 | { |
| 62 | 62 | return; |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | - $frameworkIni = $this->getFrameworkIni (); |
|
| 65 | + $frameworkIni = $this->getFrameworkIni(); |
|
| 66 | 66 | |
| 67 | 67 | require_once 'Zend/Config/Ini.php'; |
| 68 | 68 | |
| 69 | 69 | $objConfig = new \Zend_Config_Ini( |
| 70 | - realpath ( $frameworkIni ) , $this->getEnvironment () |
|
| 70 | + realpath($frameworkIni), $this->getEnvironment() |
|
| 71 | 71 | ); |
| 72 | 72 | |
| 73 | - $arrConfig = $objConfig->toArray (); |
|
| 73 | + $arrConfig = $objConfig->toArray(); |
|
| 74 | 74 | |
| 75 | - if ( isset( $arrConfig[ 'resources' ][ 'db' ] ) ) |
|
| 75 | + if (isset($arrConfig['resources']['db'])) |
|
| 76 | 76 | { |
| 77 | - $this->config = $arrConfig[ 'resources' ][ 'db' ]; |
|
| 77 | + $this->config = $arrConfig['resources']['db']; |
|
| 78 | 78 | } |
| 79 | 79 | } |
| 80 | 80 | |
@@ -83,12 +83,12 @@ discard block |
||
| 83 | 83 | * |
| 84 | 84 | * @return \Classes\AdapterMakerFile\AbstractAdapter[] |
| 85 | 85 | */ |
| 86 | - public function getMakeFileInstances () |
|
| 86 | + public function getMakeFileInstances() |
|
| 87 | 87 | { |
| 88 | - return array ( |
|
| 89 | - DbTable::getInstance () , |
|
| 90 | - Entity::getInstance () , |
|
| 91 | - Model::getInstance () |
|
| 88 | + return array( |
|
| 89 | + DbTable::getInstance(), |
|
| 90 | + Entity::getInstance(), |
|
| 91 | + Model::getInstance() |
|
| 92 | 92 | ); |
| 93 | 93 | } |
| 94 | 94 | |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | const SEPARETOR = "\\"; |
| 25 | 25 | |
| 26 | - protected function init () |
|
| 26 | + protected function init() |
|
| 27 | 27 | { |
| 28 | 28 | } |
| 29 | 29 | |
@@ -32,12 +32,12 @@ discard block |
||
| 32 | 32 | * |
| 33 | 33 | * @return array |
| 34 | 34 | */ |
| 35 | - protected function getParams () |
|
| 35 | + protected function getParams() |
|
| 36 | 36 | { |
| 37 | 37 | |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - protected function parseFrameworkConfig () |
|
| 40 | + protected function parseFrameworkConfig() |
|
| 41 | 41 | { |
| 42 | 42 | // TODO: Implement parseFrameworkConfig() method. |
| 43 | 43 | } |
@@ -45,18 +45,18 @@ discard block |
||
| 45 | 45 | /** |
| 46 | 46 | * @inheritdoc |
| 47 | 47 | */ |
| 48 | - protected function getBaseNamespace () |
|
| 48 | + protected function getBaseNamespace() |
|
| 49 | 49 | { |
| 50 | - if ( ! $this->arrConfig[ 'namespace' ] ) |
|
| 50 | + if ( ! $this->arrConfig['namespace']) |
|
| 51 | 51 | { |
| 52 | - return array ( |
|
| 53 | - 'App' , |
|
| 52 | + return array( |
|
| 53 | + 'App', |
|
| 54 | 54 | 'Model' |
| 55 | 55 | ); |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - return array ( |
|
| 59 | - $this->arrConfig[ 'namespace' ] , |
|
| 58 | + return array( |
|
| 59 | + $this->arrConfig['namespace'], |
|
| 60 | 60 | 'Model' |
| 61 | 61 | ); |
| 62 | 62 | } |
@@ -65,11 +65,11 @@ discard block |
||
| 65 | 65 | * |
| 66 | 66 | * @return \Classes\AdapterMakerFile\AbstractAdapter[] |
| 67 | 67 | */ |
| 68 | - public function getMakeFileInstances () |
|
| 68 | + public function getMakeFileInstances() |
|
| 69 | 69 | { |
| 70 | - return array ( |
|
| 71 | - Entity::getInstance () , |
|
| 72 | - Model::getInstance () |
|
| 70 | + return array( |
|
| 71 | + Entity::getInstance(), |
|
| 72 | + Model::getInstance() |
|
| 73 | 73 | ); |
| 74 | 74 | } |
| 75 | 75 | |
@@ -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,12 +31,12 @@ 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 | } |
@@ -46,12 +46,12 @@ discard block |
||
| 46 | 46 | * |
| 47 | 47 | * @return \Classes\AdapterMakerFile\AbstractAdapter[] |
| 48 | 48 | */ |
| 49 | - public function getMakeFileInstances () |
|
| 49 | + public function getMakeFileInstances() |
|
| 50 | 50 | { |
| 51 | - return array ( |
|
| 52 | - DbTable::getInstance (), |
|
| 53 | - Entity::getInstance (), |
|
| 54 | - Model::getInstance () |
|
| 51 | + return array( |
|
| 52 | + DbTable::getInstance(), |
|
| 53 | + Entity::getInstance(), |
|
| 54 | + Model::getInstance() |
|
| 55 | 55 | ); |
| 56 | 56 | } |
| 57 | 57 | |
@@ -28,60 +28,60 @@ |
||
| 28 | 28 | * |
| 29 | 29 | * @return array |
| 30 | 30 | */ |
| 31 | - public function parseRelation ( \Classes\MakerFile $makerFile, \Classes\Db\DbTable $dbTable ) |
|
| 31 | + public function parseRelation(\Classes\MakerFile $makerFile, \Classes\Db\DbTable $dbTable) |
|
| 32 | 32 | { |
| 33 | 33 | $referenceMap = ''; |
| 34 | - $references = array (); |
|
| 34 | + $references = array(); |
|
| 35 | 35 | $dependentTables = ''; |
| 36 | - $dependents = array (); |
|
| 37 | - foreach ( $dbTable->getForeingkeys () as $objColumn ) |
|
| 36 | + $dependents = array(); |
|
| 37 | + foreach ($dbTable->getForeingkeys() as $objColumn) |
|
| 38 | 38 | { |
| 39 | - $constrant = $objColumn->getFks (); |
|
| 40 | - $references[] = sprintf ( |
|
| 39 | + $constrant = $objColumn->getFks(); |
|
| 40 | + $references[] = sprintf( |
|
| 41 | 41 | " |
| 42 | 42 | '%s' => array ( |
| 43 | 43 | 'columns' => '%s' , |
| 44 | 44 | 'refTableClass' => '%s', |
| 45 | 45 | 'refColumns' =>'%s' |
| 46 | 46 | )", |
| 47 | - AbstractMaker::getClassName ( $constrant->getNameConstrant () ), |
|
| 48 | - $objColumn->getName (), |
|
| 49 | - $makerFile->getConfig ()->createClassNamespace ( $constrant ) |
|
| 47 | + AbstractMaker::getClassName($constrant->getNameConstrant()), |
|
| 48 | + $objColumn->getName(), |
|
| 49 | + $makerFile->getConfig()->createClassNamespace($constrant) |
|
| 50 | 50 | . ZendFrameworkOne::SEPARETOR |
| 51 | 51 | . 'DbTable' |
| 52 | 52 | . ZendFrameworkOne::SEPARETOR |
| 53 | - . AbstractMaker::getClassName ( $constrant->getTable () ), |
|
| 54 | - $constrant->getColumn () |
|
| 53 | + . AbstractMaker::getClassName($constrant->getTable()), |
|
| 54 | + $constrant->getColumn() |
|
| 55 | 55 | |
| 56 | 56 | ); |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - if ( sizeof ( $references ) > 0 ) |
|
| 59 | + if (sizeof($references) > 0) |
|
| 60 | 60 | { |
| 61 | 61 | $referenceMap = "protected \$_referenceMap = array(" . |
| 62 | - join ( ',', $references ) . "\n );"; |
|
| 62 | + join(',', $references) . "\n );"; |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | - foreach ( $dbTable->getDependences () as $objColumn ) |
|
| 65 | + foreach ($dbTable->getDependences() as $objColumn) |
|
| 66 | 66 | { |
| 67 | - foreach ( $objColumn->getDependences () as $dependence ) |
|
| 67 | + foreach ($objColumn->getDependences() as $dependence) |
|
| 68 | 68 | { |
| 69 | - $dependents[] = $makerFile->getConfig ()->createClassNamespace ( $dependence ) |
|
| 69 | + $dependents[] = $makerFile->getConfig()->createClassNamespace($dependence) |
|
| 70 | 70 | . ZendFrameworkOne::SEPARETOR |
| 71 | 71 | . 'DbTable' |
| 72 | 72 | . ZendFrameworkOne::SEPARETOR |
| 73 | - . AbstractMaker::getClassName ( $dependence->getTable () ); |
|
| 73 | + . AbstractMaker::getClassName($dependence->getTable()); |
|
| 74 | 74 | } |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - if ( sizeof ( $dependents ) > 0 ) |
|
| 77 | + if (sizeof($dependents) > 0) |
|
| 78 | 78 | { |
| 79 | 79 | $dependentTables = "protected \$_dependentTables = array(\n '" . |
| 80 | - join ( "',\n '", $dependents ) . "'\n );"; |
|
| 80 | + join("',\n '", $dependents) . "'\n );"; |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | |
| 84 | - return array ( |
|
| 84 | + return array( |
|
| 85 | 85 | 'referenceMap' => $referenceMap, |
| 86 | 86 | 'dependentTables' => $dependentTables |
| 87 | 87 | ); |
@@ -62,8 +62,8 @@ discard block |
||
| 62 | 62 | $parents[] = array ( |
| 63 | 63 | 'class' => $makerFile->getConfig () |
| 64 | 64 | ->createClassNamespace ( $constrant ) |
| 65 | - . ZendFrameworkOne::SEPARETOR |
|
| 66 | - . AbstractMaker::getClassName ( $constrant->getTable () ) , |
|
| 65 | + . ZendFrameworkOne::SEPARETOR |
|
| 66 | + . AbstractMaker::getClassName ( $constrant->getTable () ) , |
|
| 67 | 67 | 'function' => AbstractMaker::getClassName ( $name ) , |
| 68 | 68 | 'table' => $constrant->getTable () , |
| 69 | 69 | 'column' => $objColumn->getName () , |
@@ -103,8 +103,8 @@ discard block |
||
| 103 | 103 | $depends[] = array ( |
| 104 | 104 | 'class' => $makerFile->getConfig () |
| 105 | 105 | ->createClassNamespace ( $dependence ) |
| 106 | - . ZendFrameworkOne::SEPARETOR |
|
| 107 | - . AbstractMaker::getClassName ( $dependence->getTable () ) , |
|
| 106 | + . ZendFrameworkOne::SEPARETOR |
|
| 107 | + . AbstractMaker::getClassName ( $dependence->getTable () ) , |
|
| 108 | 108 | 'function' => AbstractMaker::getClassName ( $name ) , |
| 109 | 109 | 'table' => $dependence->getTable () , |
| 110 | 110 | 'column' => $dependence->getColumn () , |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | protected $fileTpl = "entity.php"; |
| 23 | 23 | protected $overwrite = true; |
| 24 | 24 | |
| 25 | - protected $validFunc = array (); |
|
| 25 | + protected $validFunc = array(); |
|
| 26 | 26 | |
| 27 | 27 | /** |
| 28 | 28 | * @param \Classes\MakerFile $makerFile |
@@ -30,11 +30,11 @@ discard block |
||
| 30 | 30 | * |
| 31 | 31 | * @return array |
| 32 | 32 | */ |
| 33 | - public function parseRelation ( \Classes\MakerFile $makerFile , \Classes\Db\DbTable $dbTable ) |
|
| 33 | + public function parseRelation(\Classes\MakerFile $makerFile, \Classes\Db\DbTable $dbTable) |
|
| 34 | 34 | { |
| 35 | - return array ( |
|
| 36 | - 'parents' => $this->listParents ( $makerFile , $dbTable ) , |
|
| 37 | - 'depends' => $this->listDependence ( $makerFile , $dbTable ) |
|
| 35 | + return array( |
|
| 36 | + 'parents' => $this->listParents($makerFile, $dbTable), |
|
| 37 | + 'depends' => $this->listDependence($makerFile, $dbTable) |
|
| 38 | 38 | ); |
| 39 | 39 | } |
| 40 | 40 | |
@@ -44,32 +44,32 @@ discard block |
||
| 44 | 44 | * |
| 45 | 45 | * @return array |
| 46 | 46 | */ |
| 47 | - private function listParents ( \Classes\MakerFile $makerFile , \Classes\Db\DbTable $dbTable ) |
|
| 47 | + private function listParents(\Classes\MakerFile $makerFile, \Classes\Db\DbTable $dbTable) |
|
| 48 | 48 | { |
| 49 | - $parents = array (); |
|
| 50 | - foreach ( $dbTable->getForeingkeys () as $objColumn ) |
|
| 49 | + $parents = array(); |
|
| 50 | + foreach ($dbTable->getForeingkeys() as $objColumn) |
|
| 51 | 51 | { |
| 52 | - $constrant = $objColumn->getFks (); |
|
| 52 | + $constrant = $objColumn->getFks(); |
|
| 53 | 53 | $name = |
| 54 | 54 | 'Parent' |
| 55 | 55 | . ZendFrameworkOne::SEPARETOR |
| 56 | - . AbstractMaker::getClassName ( $constrant->getTable () ) |
|
| 56 | + . AbstractMaker::getClassName($constrant->getTable()) |
|
| 57 | 57 | . ZendFrameworkOne::SEPARETOR |
| 58 | 58 | . 'By' |
| 59 | 59 | . ZendFrameworkOne::SEPARETOR |
| 60 | - . $objColumn->getName (); |
|
| 60 | + . $objColumn->getName(); |
|
| 61 | 61 | |
| 62 | - $parents[] = array ( |
|
| 63 | - 'class' => $makerFile->getConfig () |
|
| 64 | - ->createClassNamespace ( $constrant ) |
|
| 62 | + $parents[] = array( |
|
| 63 | + 'class' => $makerFile->getConfig() |
|
| 64 | + ->createClassNamespace($constrant) |
|
| 65 | 65 | . ZendFrameworkOne::SEPARETOR |
| 66 | - . AbstractMaker::getClassName ( $constrant->getTable () ) , |
|
| 67 | - 'function' => AbstractMaker::getClassName ( $name ) , |
|
| 68 | - 'table' => $constrant->getTable () , |
|
| 69 | - 'column' => $objColumn->getName () , |
|
| 70 | - 'name' => $constrant->getNameConstrant () , |
|
| 66 | + . AbstractMaker::getClassName($constrant->getTable()), |
|
| 67 | + 'function' => AbstractMaker::getClassName($name), |
|
| 68 | + 'table' => $constrant->getTable(), |
|
| 69 | + 'column' => $objColumn->getName(), |
|
| 70 | + 'name' => $constrant->getNameConstrant(), |
|
| 71 | 71 | ); |
| 72 | - unset( $name ); |
|
| 72 | + unset($name); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | return $parents; |
@@ -81,37 +81,37 @@ discard block |
||
| 81 | 81 | * |
| 82 | 82 | * @return array |
| 83 | 83 | */ |
| 84 | - private function listDependence ( \Classes\MakerFile $makerFile , \Classes\Db\DbTable $dbTable ) |
|
| 84 | + private function listDependence(\Classes\MakerFile $makerFile, \Classes\Db\DbTable $dbTable) |
|
| 85 | 85 | { |
| 86 | - $depends = array (); |
|
| 87 | - foreach ( $dbTable->getDependences () as $objColumn ) |
|
| 86 | + $depends = array(); |
|
| 87 | + foreach ($dbTable->getDependences() as $objColumn) |
|
| 88 | 88 | { |
| 89 | - foreach ( $objColumn->getDependences () as $dependence ) |
|
| 89 | + foreach ($objColumn->getDependences() as $dependence) |
|
| 90 | 90 | { |
| 91 | 91 | $name = |
| 92 | 92 | 'Depend' |
| 93 | 93 | . ZendFrameworkOne::SEPARETOR |
| 94 | - . AbstractMaker::getClassName ( $dependence->getTable () ) |
|
| 94 | + . AbstractMaker::getClassName($dependence->getTable()) |
|
| 95 | 95 | . ZendFrameworkOne::SEPARETOR |
| 96 | 96 | . 'By' |
| 97 | 97 | . ZendFrameworkOne::SEPARETOR |
| 98 | - . $objColumn->getName (); |
|
| 98 | + . $objColumn->getName(); |
|
| 99 | 99 | |
| 100 | - if ( ! key_exists ( $name , $this->validFunc ) ) |
|
| 100 | + if ( ! key_exists($name, $this->validFunc)) |
|
| 101 | 101 | { |
| 102 | - $this->validFunc[ $name ] = true; |
|
| 103 | - $depends[] = array ( |
|
| 104 | - 'class' => $makerFile->getConfig () |
|
| 105 | - ->createClassNamespace ( $dependence ) |
|
| 102 | + $this->validFunc[$name] = true; |
|
| 103 | + $depends[] = array( |
|
| 104 | + 'class' => $makerFile->getConfig() |
|
| 105 | + ->createClassNamespace($dependence) |
|
| 106 | 106 | . ZendFrameworkOne::SEPARETOR |
| 107 | - . AbstractMaker::getClassName ( $dependence->getTable () ) , |
|
| 108 | - 'function' => AbstractMaker::getClassName ( $name ) , |
|
| 109 | - 'table' => $dependence->getTable () , |
|
| 110 | - 'column' => $dependence->getColumn () , |
|
| 111 | - 'name' => $dependence->getNameConstrant () |
|
| 107 | + . AbstractMaker::getClassName($dependence->getTable()), |
|
| 108 | + 'function' => AbstractMaker::getClassName($name), |
|
| 109 | + 'table' => $dependence->getTable(), |
|
| 110 | + 'column' => $dependence->getColumn(), |
|
| 111 | + 'name' => $dependence->getNameConstrant() |
|
| 112 | 112 | ); |
| 113 | 113 | } |
| 114 | - unset( $name ); |
|
| 114 | + unset($name); |
|
| 115 | 115 | } |
| 116 | 116 | } |
| 117 | 117 | |
@@ -19,6 +19,6 @@ |
||
| 19 | 19 | |
| 20 | 20 | public function parseRelation ( \Classes\MakerFile $makerFile, \Classes\Db\DbTable $dbTable ) |
| 21 | 21 | { |
| 22 | - return array(); |
|
| 22 | + return array(); |
|
| 23 | 23 | } |
| 24 | 24 | } |
@@ -12,9 +12,9 @@ |
||
| 12 | 12 | /** |
| 13 | 13 | * @var void |
| 14 | 14 | */ |
| 15 | - protected $fileTpl = "model.php"; |
|
| 15 | + protected $fileTpl = "model.php"; |
|
| 16 | 16 | |
| 17 | - public function parseRelation ( \Classes\MakerFile $makerFile, \Classes\Db\DbTable $dbTable ) |
|
| 17 | + public function parseRelation(\Classes\MakerFile $makerFile, \Classes\Db\DbTable $dbTable) |
|
| 18 | 18 | { |
| 19 | 19 | return array(); |
| 20 | 20 | } |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | protected $fileTpl = "entity.php"; |
| 21 | 21 | protected $overwrite = true; |
| 22 | 22 | |
| 23 | - protected $validFunc = array (); |
|
| 23 | + protected $validFunc = array(); |
|
| 24 | 24 | |
| 25 | 25 | /** |
| 26 | 26 | * @param \Classes\MakerFile $makerFile |
@@ -28,12 +28,12 @@ discard block |
||
| 28 | 28 | * |
| 29 | 29 | * @return array |
| 30 | 30 | */ |
| 31 | - public function parseRelation ( \Classes\MakerFile $makerFile , \Classes\Db\DbTable $dbTable ) |
|
| 31 | + public function parseRelation(\Classes\MakerFile $makerFile, \Classes\Db\DbTable $dbTable) |
|
| 32 | 32 | { |
| 33 | 33 | |
| 34 | - return array ( |
|
| 35 | - 'mapParents' => $this->listParents ( $makerFile , $dbTable ) , |
|
| 36 | - 'mapDependents' => $this->listDependence ( $makerFile , $dbTable ) |
|
| 34 | + return array( |
|
| 35 | + 'mapParents' => $this->listParents($makerFile, $dbTable), |
|
| 36 | + 'mapDependents' => $this->listDependence($makerFile, $dbTable) |
|
| 37 | 37 | ); |
| 38 | 38 | } |
| 39 | 39 | |
@@ -43,27 +43,27 @@ discard block |
||
| 43 | 43 | * |
| 44 | 44 | * @return array |
| 45 | 45 | */ |
| 46 | - private function listParents ( \Classes\MakerFile $makerFile , \Classes\Db\DbTable $dbTable ) |
|
| 46 | + private function listParents(\Classes\MakerFile $makerFile, \Classes\Db\DbTable $dbTable) |
|
| 47 | 47 | { |
| 48 | 48 | $mapParents = ''; |
| 49 | - $references = array (); |
|
| 50 | - foreach ( $dbTable->getForeingkeys () as $objColumn ) |
|
| 49 | + $references = array(); |
|
| 50 | + foreach ($dbTable->getForeingkeys() as $objColumn) |
|
| 51 | 51 | { |
| 52 | - $constrant = $objColumn->getFks (); |
|
| 53 | - $references[] = sprintf ( |
|
| 54 | - "\$this->hasMany('%s', '%s', '%s')" , |
|
| 55 | - $objColumn->getName () , |
|
| 56 | - $makerFile->getConfig ()->createClassNamespace ( $constrant ) |
|
| 52 | + $constrant = $objColumn->getFks(); |
|
| 53 | + $references[] = sprintf( |
|
| 54 | + "\$this->hasMany('%s', '%s', '%s')", |
|
| 55 | + $objColumn->getName(), |
|
| 56 | + $makerFile->getConfig()->createClassNamespace($constrant) |
|
| 57 | 57 | . Phalcon::SEPARETOR |
| 58 | - . AbstractMaker::getClassName ( $constrant->getTable () ) , |
|
| 59 | - $constrant->getColumn () |
|
| 58 | + . AbstractMaker::getClassName($constrant->getTable()), |
|
| 59 | + $constrant->getColumn() |
|
| 60 | 60 | |
| 61 | 61 | ); |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - if ( sizeof ( $references ) > 0 ) |
|
| 64 | + if (sizeof($references) > 0) |
|
| 65 | 65 | { |
| 66 | - $mapParents = join ( ";\n\t\t" , $references ) . ";\n"; |
|
| 66 | + $mapParents = join(";\n\t\t", $references) . ";\n"; |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | |
@@ -76,29 +76,29 @@ discard block |
||
| 76 | 76 | * |
| 77 | 77 | * @return array |
| 78 | 78 | */ |
| 79 | - private function listDependence ( \Classes\MakerFile $makerFile , \Classes\Db\DbTable $dbTable ) |
|
| 79 | + private function listDependence(\Classes\MakerFile $makerFile, \Classes\Db\DbTable $dbTable) |
|
| 80 | 80 | { |
| 81 | 81 | $mapDependence = ''; |
| 82 | - $references = array (); |
|
| 83 | - foreach ( $dbTable->getDependences () as $objColumn ) |
|
| 82 | + $references = array(); |
|
| 83 | + foreach ($dbTable->getDependences() as $objColumn) |
|
| 84 | 84 | { |
| 85 | - foreach ( $objColumn->getDependences () as $dependence ) |
|
| 85 | + foreach ($objColumn->getDependences() as $dependence) |
|
| 86 | 86 | { |
| 87 | - $references[] = sprintf ( |
|
| 88 | - "\$this->belongsTo('%s', '%s', '%s')" , |
|
| 89 | - $objColumn->getName () , |
|
| 90 | - $makerFile->getConfig ()->createClassNamespace ( $dependence ) |
|
| 87 | + $references[] = sprintf( |
|
| 88 | + "\$this->belongsTo('%s', '%s', '%s')", |
|
| 89 | + $objColumn->getName(), |
|
| 90 | + $makerFile->getConfig()->createClassNamespace($dependence) |
|
| 91 | 91 | . Phalcon::SEPARETOR |
| 92 | - . AbstractMaker::getClassName ( $dependence->getTable () ) , |
|
| 93 | - $dependence->getColumn () |
|
| 92 | + . AbstractMaker::getClassName($dependence->getTable()), |
|
| 93 | + $dependence->getColumn() |
|
| 94 | 94 | ); |
| 95 | 95 | |
| 96 | 96 | } |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - if ( sizeof ( $references ) > 0 ) |
|
| 99 | + if (sizeof($references) > 0) |
|
| 100 | 100 | { |
| 101 | - $mapDependence = join ( ";\n\t\t" , $references ) . ";"; |
|
| 101 | + $mapDependence = join(";\n\t\t", $references) . ";"; |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | return $mapDependence; |