@@ -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 | } |
@@ -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 | } |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | '$this->belongsTo(\'%s\', \'%s\', \'%s\', array(\'alias\' => \'%s\'))', |
55 | 55 | $objColumn->getName (), |
56 | 56 | $makerFile->getConfig () |
57 | - ->createClassNamespace ( $constrant ) . Phalcon::SEPARETOR . AbstractMaker::getClassName ( |
|
57 | + ->createClassNamespace ( $constrant ) . Phalcon::SEPARETOR . AbstractMaker::getClassName ( |
|
58 | 58 | $constrant->getTable () |
59 | 59 | ), |
60 | 60 | $constrant->getColumn (), |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | '$this->hasMany(\'%s\', \'%s\', \'%s\', array(\'alias\' => \'%s\'))', |
87 | 87 | $objColumn->getName (), |
88 | 88 | $makerFile->getConfig () |
89 | - ->createClassNamespace ( $dependence ) |
|
89 | + ->createClassNamespace ( $dependence ) |
|
90 | 90 | . Phalcon::SEPARETOR |
91 | 91 | . AbstractMaker::getClassName ( $dependence->getTable () ), |
92 | 92 | $dependence->getColumn (), |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | |
172 | 172 | $pdo = $this->getPDO (); |
173 | 173 | $return1 = $pdo->query ( "SELECT pg_get_serial_sequence('$tableTemp', '$column');" ) |
174 | - ->fetchColumn (); |
|
174 | + ->fetchColumn (); |
|
175 | 175 | |
176 | 176 | if ( !is_null ( $return1 ) ) { |
177 | 177 | return $return1; |
@@ -247,14 +247,14 @@ discard block |
||
247 | 247 | $strSchema = implode ( "', '", $this->schema ); |
248 | 248 | |
249 | 249 | $this->totalTables = $this->getPDO () |
250 | - ->query ( |
|
251 | - "SELECT COUNT(table_name) AS total |
|
250 | + ->query ( |
|
251 | + "SELECT COUNT(table_name) AS total |
|
252 | 252 | FROM information_schema.tables |
253 | 253 | WHERE |
254 | 254 | table_type = 'BASE TABLE' |
255 | 255 | AND table_schema IN ( '" . $strSchema . "' )" |
256 | - ) |
|
257 | - ->fetchColumn (); |
|
256 | + ) |
|
257 | + ->fetchColumn (); |
|
258 | 258 | } |
259 | 259 | |
260 | 260 | return (int) $this->totalTables; |
@@ -205,15 +205,15 @@ |
||
205 | 205 | public function createDependece ( $constraint_name, $table_name, $column_name, $database, $schema = null ) |
206 | 206 | { |
207 | 207 | $objConstrantDependence = Constrant::getInstance () |
208 | - ->populate ( |
|
209 | - array ( |
|
210 | - 'constrant' => $constraint_name, |
|
211 | - 'schema' => $schema, |
|
212 | - 'table' => $table_name, |
|
213 | - 'column' => $column_name, |
|
214 | - 'database' => $database |
|
215 | - ) |
|
216 | - ); |
|
208 | + ->populate ( |
|
209 | + array ( |
|
210 | + 'constrant' => $constraint_name, |
|
211 | + 'schema' => $schema, |
|
212 | + 'table' => $table_name, |
|
213 | + 'column' => $column_name, |
|
214 | + 'database' => $database |
|
215 | + ) |
|
216 | + ); |
|
217 | 217 | |
218 | 218 | $this->addDependece ( $objConstrantDependence ); |
219 | 219 |
@@ -174,10 +174,10 @@ discard block |
||
174 | 174 | $sqlTables = !empty($this->tablesName)?"AND table_name IN ( $this->tablesName )":''; |
175 | 175 | |
176 | 176 | $this->totalTables = $this->getPDO () |
177 | - ->query ( |
|
178 | - "SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = '{$this->database}' $sqlTables" |
|
179 | - ) |
|
180 | - ->fetchColumn (); |
|
177 | + ->query ( |
|
178 | + "SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = '{$this->database}' $sqlTables" |
|
179 | + ) |
|
180 | + ->fetchColumn (); |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | return (int) $this->totalTables; |
@@ -194,10 +194,10 @@ discard block |
||
194 | 194 | public function getSequence ( $table, $column, $schema = 0 ) |
195 | 195 | { |
196 | 196 | $return = $this->getPDO () |
197 | - ->query ( |
|
198 | - "select * from information_schema.columns where extra like '%auto_increment%' and TABLE_SCHEMA='{$this->database}' AND TABLE_NAME='{$table}' AND COLUMN_NAME='{$column}';" |
|
199 | - ) |
|
200 | - ->fetch ( \PDO::FETCH_ASSOC ); |
|
197 | + ->query ( |
|
198 | + "select * from information_schema.columns where extra like '%auto_increment%' and TABLE_SCHEMA='{$this->database}' AND TABLE_NAME='{$table}' AND COLUMN_NAME='{$column}';" |
|
199 | + ) |
|
200 | + ->fetch ( \PDO::FETCH_ASSOC ); |
|
201 | 201 | |
202 | 202 | if ( !$return ) { |
203 | 203 | return; |
@@ -55,7 +55,7 @@ |
||
55 | 55 | foreach ( $this->objDbTables as $objDbTable ) |
56 | 56 | { |
57 | 57 | $this->toArrayFileName[] = AbstractMaker::getClassName ( $objDbTable->getName () ) |
58 | - . '.php'; |
|
58 | + . '.php'; |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | return $this->toArrayFileName; |
@@ -400,7 +400,7 @@ |
||
400 | 400 | $matches = preg_grep ( '*\.*' , $this->getTablesName () ); |
401 | 401 | if ( count ( $matches ) ) |
402 | 402 | { |
403 | - die("\033[0;31mError: Table name must not contain the schema.\033[0m\n"); |
|
403 | + die("\033[0;31mError: Table name must not contain the schema.\033[0m\n"); |
|
404 | 404 | } |
405 | 405 | } |
406 | 406 |
@@ -115,32 +115,32 @@ discard block |
||
115 | 115 | if ( $table->hasColumn ( $constrant[ "column_name" ] ) ) |
116 | 116 | { |
117 | 117 | $objConstrant = Constrant::getInstance () |
118 | - ->populate ( |
|
119 | - array ( |
|
120 | - 'constrant' => $constrant[ 'constraint_name' ] , |
|
121 | - 'schema' => $constrant[ 'foreign_schema' ] , |
|
122 | - 'table' => $constrant[ 'foreign_table' ] , |
|
123 | - 'column' => $constrant[ 'foreign_column' ] , |
|
124 | - 'database' => $this->database |
|
125 | - ) |
|
126 | - ); |
|
118 | + ->populate ( |
|
119 | + array ( |
|
120 | + 'constrant' => $constrant[ 'constraint_name' ] , |
|
121 | + 'schema' => $constrant[ 'foreign_schema' ] , |
|
122 | + 'table' => $constrant[ 'foreign_table' ] , |
|
123 | + 'column' => $constrant[ 'foreign_column' ] , |
|
124 | + 'database' => $this->database |
|
125 | + ) |
|
126 | + ); |
|
127 | 127 | |
128 | 128 | switch ( $constrant[ 'constraint_type' ] ) |
129 | 129 | { |
130 | 130 | case "FOREIGN KEY": |
131 | 131 | $table->getColumn ( $constrant[ "column_name" ] ) |
132 | - ->addRefFk ( $objConstrant ); |
|
132 | + ->addRefFk ( $objConstrant ); |
|
133 | 133 | break; |
134 | 134 | case"PRIMARY KEY": |
135 | 135 | $table->getColumn ( $constrant[ "column_name" ] ) |
136 | - ->setPrimaryKey ( $objConstrant ) |
|
137 | - ->setSequence ( |
|
138 | - $this->getSequence ( |
|
139 | - $table_name , |
|
140 | - $constrant[ "column_name" ] , |
|
141 | - $schema |
|
142 | - ) |
|
143 | - ); |
|
136 | + ->setPrimaryKey ( $objConstrant ) |
|
137 | + ->setSequence ( |
|
138 | + $this->getSequence ( |
|
139 | + $table_name , |
|
140 | + $constrant[ "column_name" ] , |
|
141 | + $schema |
|
142 | + ) |
|
143 | + ); |
|
144 | 144 | break; |
145 | 145 | } |
146 | 146 | } |
@@ -160,13 +160,13 @@ discard block |
||
160 | 160 | if ( $table->hasColumn ( $constrant[ "foreign_column" ] ) ) |
161 | 161 | { |
162 | 162 | $table->getColumn ( $constrant[ "foreign_column" ] ) |
163 | - ->createDependece ( |
|
164 | - $constrant[ 'constraint_name' ] , |
|
165 | - $constrant[ 'table_name' ] , |
|
166 | - $constrant[ 'column_name' ] , |
|
167 | - $this->database , |
|
168 | - $constrant[ 'table_schema' ] |
|
169 | - ); |
|
163 | + ->createDependece ( |
|
164 | + $constrant[ 'constraint_name' ] , |
|
165 | + $constrant[ 'table_name' ] , |
|
166 | + $constrant[ 'column_name' ] , |
|
167 | + $this->database , |
|
168 | + $constrant[ 'table_schema' ] |
|
169 | + ); |
|
170 | 170 | } |
171 | 171 | } |
172 | 172 | } |
@@ -201,10 +201,10 @@ discard block |
||
201 | 201 | ); |
202 | 202 | |
203 | 203 | $this->getTable ( $key , $schema ) |
204 | - ->addColumn ( $column ) |
|
205 | - ->setNamespace ( |
|
206 | - $this->config->createClassNamespace ( $this->getTable ( $key , $schema ) ) |
|
207 | - ); |
|
204 | + ->addColumn ( $column ) |
|
205 | + ->setNamespace ( |
|
206 | + $this->config->createClassNamespace ( $this->getTable ( $key , $schema ) ) |
|
207 | + ); |
|
208 | 208 | } |
209 | 209 | } |
210 | 210 | |
@@ -279,13 +279,13 @@ discard block |
||
279 | 279 | } |
280 | 280 | |
281 | 281 | $this->objDbTables[ $schema ][ trim ( $nameTable ) ] = DbTable::getInstance () |
282 | - ->populate ( |
|
283 | - array ( |
|
284 | - 'table' => $nameTable , |
|
285 | - 'schema' => $schema , |
|
286 | - 'database' => $this->database |
|
287 | - ) |
|
288 | - ); |
|
282 | + ->populate ( |
|
283 | + array ( |
|
284 | + 'table' => $nameTable , |
|
285 | + 'schema' => $schema , |
|
286 | + 'database' => $this->database |
|
287 | + ) |
|
288 | + ); |
|
289 | 289 | |
290 | 290 | return $this; |
291 | 291 | } |