@@ -106,30 +106,30 @@ discard block |
||
106 | 106 | if ( $table->hasColumn ( $constrant[ "column_name" ] ) ) |
107 | 107 | { |
108 | 108 | $objConstrant = Constrant::getInstance () |
109 | - ->populate ( |
|
110 | - array ( |
|
111 | - 'constrant' => $constrant[ 'constraint_name' ] , |
|
112 | - 'schema' => $constrant[ 'foreign_schema' ] , |
|
113 | - 'table' => $constrant[ 'foreign_table' ] , |
|
114 | - 'column' => $constrant[ 'foreign_column' ] |
|
115 | - ) |
|
116 | - ); |
|
109 | + ->populate ( |
|
110 | + array ( |
|
111 | + 'constrant' => $constrant[ 'constraint_name' ] , |
|
112 | + 'schema' => $constrant[ 'foreign_schema' ] , |
|
113 | + 'table' => $constrant[ 'foreign_table' ] , |
|
114 | + 'column' => $constrant[ 'foreign_column' ] |
|
115 | + ) |
|
116 | + ); |
|
117 | 117 | |
118 | 118 | switch ( $constrant[ 'constraint_type' ] ) |
119 | 119 | { |
120 | 120 | case "FOREIGN KEY": |
121 | 121 | $table->getColumn ( $constrant[ "column_name" ] ) |
122 | - ->addRefFk ( $objConstrant ); |
|
122 | + ->addRefFk ( $objConstrant ); |
|
123 | 123 | break; |
124 | 124 | case"PRIMARY KEY": |
125 | 125 | $table->getColumn ( $constrant[ "column_name" ] ) |
126 | - ->setPrimaryKey ( $objConstrant ) |
|
127 | - ->setSequence ( |
|
128 | - $this->getSequence ( |
|
129 | - $schema . '.' . $table_name , |
|
130 | - $constrant[ "column_name" ] |
|
131 | - ) |
|
132 | - ); |
|
126 | + ->setPrimaryKey ( $objConstrant ) |
|
127 | + ->setSequence ( |
|
128 | + $this->getSequence ( |
|
129 | + $schema . '.' . $table_name , |
|
130 | + $constrant[ "column_name" ] |
|
131 | + ) |
|
132 | + ); |
|
133 | 133 | break; |
134 | 134 | } |
135 | 135 | } |
@@ -149,12 +149,12 @@ discard block |
||
149 | 149 | if ( $table->hasColumn ( $constrant[ "foreign_column" ] ) ) |
150 | 150 | { |
151 | 151 | $table->getColumn ( $constrant[ "foreign_column" ] ) |
152 | - ->createDependece ( |
|
153 | - $constrant[ 'constraint_name' ] , |
|
154 | - $constrant[ 'table_name' ] , |
|
155 | - $constrant[ 'column_name' ] , |
|
156 | - $constrant[ 'table_schema' ] |
|
157 | - ); |
|
152 | + ->createDependece ( |
|
153 | + $constrant[ 'constraint_name' ] , |
|
154 | + $constrant[ 'table_name' ] , |
|
155 | + $constrant[ 'column_name' ] , |
|
156 | + $constrant[ 'table_schema' ] |
|
157 | + ); |
|
158 | 158 | } |
159 | 159 | } |
160 | 160 | } |
@@ -220,13 +220,13 @@ discard block |
||
220 | 220 | public function createTable ( $nameTable , $schema = 0 ) |
221 | 221 | { |
222 | 222 | $this->objDbTables[ $schema ][ trim ( $nameTable ) ] = DbTable::getInstance () |
223 | - ->populate ( |
|
224 | - array ( |
|
225 | - 'table' => $nameTable , |
|
226 | - 'schema' => $schema , |
|
227 | - 'database' => $this->database |
|
228 | - ) |
|
229 | - ); |
|
223 | + ->populate ( |
|
224 | + array ( |
|
225 | + 'table' => $nameTable , |
|
226 | + 'schema' => $schema , |
|
227 | + 'database' => $this->database |
|
228 | + ) |
|
229 | + ); |
|
230 | 230 | |
231 | 231 | return $this; |
232 | 232 | } |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | { |
165 | 165 | $pdo = $this->getPDO (); |
166 | 166 | $return1 = $pdo->query ( "SELECT pg_get_serial_sequence('$table', '$column');" ) |
167 | - ->fetchColumn (); |
|
167 | + ->fetchColumn (); |
|
168 | 168 | |
169 | 169 | if ( $return1 ) |
170 | 170 | { |
@@ -229,10 +229,10 @@ discard block |
||
229 | 229 | ); |
230 | 230 | |
231 | 231 | $this->getTable ( $key , $schema ) |
232 | - ->addColumn ( $column ) |
|
233 | - ->setNamespace ( |
|
234 | - $this->config->createClassNamespace ( $this->getTable ( $key , $schema ) ) |
|
235 | - ); |
|
232 | + ->addColumn ( $column ) |
|
233 | + ->setNamespace ( |
|
234 | + $this->config->createClassNamespace ( $this->getTable ( $key , $schema ) ) |
|
235 | + ); |
|
236 | 236 | } |
237 | 237 | } |
238 | 238 |
@@ -82,10 +82,10 @@ discard block |
||
82 | 82 | ); |
83 | 83 | |
84 | 84 | $this->getTable ( $key , $schema ) |
85 | - ->addColumn ( $column ) |
|
86 | - ->setNamespace ( |
|
87 | - $this->config->createClassNamespace ( $this->getTable ( $key , $schema ) ) |
|
88 | - ); |
|
85 | + ->addColumn ( $column ) |
|
86 | + ->setNamespace ( |
|
87 | + $this->config->createClassNamespace ( $this->getTable ( $key , $schema ) ) |
|
88 | + ); |
|
89 | 89 | } |
90 | 90 | } |
91 | 91 | |
@@ -208,8 +208,8 @@ discard block |
||
208 | 208 | public function getSequence ( $table , $column ) |
209 | 209 | { |
210 | 210 | $return = $this->getPDO () |
211 | - ->query ( "select * from information_schema.columns where extra like '%auto_increment%' and TABLE_SCHEMA='{$this->database}' AND TABLE_NAME='{$table}' AND COLUMN_NAME='{$column}';" ) |
|
212 | - ->fetch ( \PDO::FETCH_ASSOC ); |
|
211 | + ->query ( "select * from information_schema.columns where extra like '%auto_increment%' and TABLE_SCHEMA='{$this->database}' AND TABLE_NAME='{$table}' AND COLUMN_NAME='{$column}';" ) |
|
212 | + ->fetch ( \PDO::FETCH_ASSOC ); |
|
213 | 213 | |
214 | 214 | if ( ! $return ) |
215 | 215 | { |
@@ -178,14 +178,14 @@ |
||
178 | 178 | public function createDependece ( $constraint_name , $table_name , $column_name , $schema = null ) |
179 | 179 | { |
180 | 180 | $objConstrantDependence = Constrant::getInstance () |
181 | - ->populate ( |
|
182 | - array ( |
|
183 | - 'constrant' => $constraint_name , |
|
184 | - 'schema' => $schema , |
|
185 | - 'table' => $table_name , |
|
186 | - 'column' => $column_name |
|
187 | - ) |
|
188 | - ); |
|
181 | + ->populate ( |
|
182 | + array ( |
|
183 | + 'constrant' => $constraint_name , |
|
184 | + 'schema' => $schema , |
|
185 | + 'table' => $table_name , |
|
186 | + 'column' => $column_name |
|
187 | + ) |
|
188 | + ); |
|
189 | 189 | |
190 | 190 | $this->addDependece ( $objConstrantDependence ); |
191 | 191 |