@@ -169,10 +169,10 @@ discard block |
||
169 | 169 | if ( empty( $this->totalTables ) ) { |
170 | 170 | |
171 | 171 | $this->totalTables = $this->getPDO () |
172 | - ->query ( |
|
173 | - "SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = '{$this->database}'" |
|
174 | - ) |
|
175 | - ->fetchColumn (); |
|
172 | + ->query ( |
|
173 | + "SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = '{$this->database}'" |
|
174 | + ) |
|
175 | + ->fetchColumn (); |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | return (int) $this->totalTables; |
@@ -189,10 +189,10 @@ discard block |
||
189 | 189 | public function getSequence ( $table, $column, $schema = 0 ) |
190 | 190 | { |
191 | 191 | $return = $this->getPDO () |
192 | - ->query ( |
|
193 | - "select * from information_schema.columns where extra like '%auto_increment%' and TABLE_SCHEMA='{$this->database}' AND TABLE_NAME='{$table}' AND COLUMN_NAME='{$column}';" |
|
194 | - ) |
|
195 | - ->fetch ( \PDO::FETCH_ASSOC ); |
|
192 | + ->query ( |
|
193 | + "select * from information_schema.columns where extra like '%auto_increment%' and TABLE_SCHEMA='{$this->database}' AND TABLE_NAME='{$table}' AND COLUMN_NAME='{$column}';" |
|
194 | + ) |
|
195 | + ->fetch ( \PDO::FETCH_ASSOC ); |
|
196 | 196 | |
197 | 197 | if ( !$return ) { |
198 | 198 | return; |
@@ -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; |
@@ -103,31 +103,31 @@ discard block |
||
103 | 103 | $table = $this->getTable ( $table_name, $schema ); |
104 | 104 | if ( $table->hasColumn ( $constrant[ "column_name" ] ) ) { |
105 | 105 | $objConstrant = Constrant::getInstance () |
106 | - ->populate ( |
|
107 | - array ( |
|
108 | - 'constrant' => $constrant[ 'constraint_name' ], |
|
109 | - 'schema' => $constrant[ 'foreign_schema' ], |
|
110 | - 'table' => $constrant[ 'foreign_table' ], |
|
111 | - 'column' => $constrant[ 'foreign_column' ], |
|
112 | - 'database' => $this->database |
|
113 | - ) |
|
114 | - ); |
|
106 | + ->populate ( |
|
107 | + array ( |
|
108 | + 'constrant' => $constrant[ 'constraint_name' ], |
|
109 | + 'schema' => $constrant[ 'foreign_schema' ], |
|
110 | + 'table' => $constrant[ 'foreign_table' ], |
|
111 | + 'column' => $constrant[ 'foreign_column' ], |
|
112 | + 'database' => $this->database |
|
113 | + ) |
|
114 | + ); |
|
115 | 115 | |
116 | 116 | switch ( $constrant[ 'constraint_type' ] ) { |
117 | 117 | case "FOREIGN KEY": |
118 | 118 | $table->getColumn ( $constrant[ "column_name" ] ) |
119 | - ->addRefFk ( $objConstrant ); |
|
119 | + ->addRefFk ( $objConstrant ); |
|
120 | 120 | break; |
121 | 121 | case"PRIMARY KEY": |
122 | 122 | $table->getColumn ( $constrant[ "column_name" ] ) |
123 | - ->setPrimaryKey ( $objConstrant ) |
|
124 | - ->setSequence ( |
|
125 | - $this->getSequence ( |
|
126 | - $table_name, |
|
127 | - $constrant[ "column_name" ], |
|
128 | - $schema |
|
129 | - ) |
|
130 | - ); |
|
123 | + ->setPrimaryKey ( $objConstrant ) |
|
124 | + ->setSequence ( |
|
125 | + $this->getSequence ( |
|
126 | + $table_name, |
|
127 | + $constrant[ "column_name" ], |
|
128 | + $schema |
|
129 | + ) |
|
130 | + ); |
|
131 | 131 | break; |
132 | 132 | } |
133 | 133 | } |
@@ -145,13 +145,13 @@ discard block |
||
145 | 145 | $table = $this->getTable ( $table_name, $schema ); |
146 | 146 | if ( $table->hasColumn ( $constrant[ "foreign_column" ] ) ) { |
147 | 147 | $table->getColumn ( $constrant[ "foreign_column" ] ) |
148 | - ->createDependece ( |
|
149 | - $constrant[ 'constraint_name' ], |
|
150 | - $constrant[ 'table_name' ], |
|
151 | - $constrant[ 'column_name' ], |
|
152 | - $this->database, |
|
153 | - $constrant[ 'table_schema' ] |
|
154 | - ); |
|
148 | + ->createDependece ( |
|
149 | + $constrant[ 'constraint_name' ], |
|
150 | + $constrant[ 'table_name' ], |
|
151 | + $constrant[ 'column_name' ], |
|
152 | + $this->database, |
|
153 | + $constrant[ 'table_schema' ] |
|
154 | + ); |
|
155 | 155 | } |
156 | 156 | } |
157 | 157 | } |
@@ -183,10 +183,10 @@ discard block |
||
183 | 183 | ); |
184 | 184 | |
185 | 185 | $this->getTable ( $key, $schema ) |
186 | - ->addColumn ( $column ) |
|
187 | - ->setNamespace ( |
|
188 | - $this->config->createClassNamespace ( $this->getTable ( $key, $schema ) ) |
|
189 | - ); |
|
186 | + ->addColumn ( $column ) |
|
187 | + ->setNamespace ( |
|
188 | + $this->config->createClassNamespace ( $this->getTable ( $key, $schema ) ) |
|
189 | + ); |
|
190 | 190 | } |
191 | 191 | } |
192 | 192 | |
@@ -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 | } |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | { |
89 | 89 | foreach ( $arrFoldersName as $index => $folderName ) { |
90 | 90 | $arrFoldersName[ $index ] = $this->getConfig () |
91 | - ->replaceReservedWord ( $folderName ); |
|
91 | + ->replaceReservedWord ( $folderName ); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | return implode ( DIRECTORY_SEPARATOR, array_filter ( $arrFoldersName ) ); |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | $folderName, |
142 | 142 | $this->getClassName ( |
143 | 143 | $this->getConfig () |
144 | - ->getDatabase () |
|
144 | + ->getDatabase () |
|
145 | 145 | ) |
146 | 146 | ); |
147 | 147 | $this->location = array ( $this->filterLocation ( $url ) ); |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | * @return String |
274 | 274 | */ |
275 | 275 | protected function getParsedTplContents ( $tplFile, $vars = array (), \Classes\Db\DbTable $objTables = null, |
276 | - $objMakeFile = null ) |
|
276 | + $objMakeFile = null ) |
|
277 | 277 | { |
278 | 278 | |
279 | 279 | $arrUrl = array ( |
@@ -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 |