| @@ 58-90 (lines=33) @@ | ||
| 55 | /** |
|
| 56 | * @inheritDoc |
|
| 57 | */ |
|
| 58 | public function parseTables () |
|
| 59 | { |
|
| 60 | if ( $this->hasTables () ) |
|
| 61 | { |
|
| 62 | return $this->getAllTables (); |
|
| 63 | } |
|
| 64 | ||
| 65 | $schema = 0; |
|
| 66 | foreach ( $this->getListColumns () as $table ) |
|
| 67 | { |
|
| 68 | $key = $table [ 'table_name' ]; |
|
| 69 | if ( ! $this->hasTable ( $key , $schema ) ) |
|
| 70 | { |
|
| 71 | $this->createTable ( $key , $schema ); |
|
| 72 | } |
|
| 73 | ||
| 74 | $column = Column::getInstance () |
|
| 75 | ->populate ( |
|
| 76 | array ( |
|
| 77 | 'name' => $table [ 'column_name' ] , |
|
| 78 | 'type' => $this->convertTypeToPhp ( $table[ 'data_type' ] ) , |
|
| 79 | 'nullable' => ( $table[ 'is_nullable' ] == 'YES' ) , |
|
| 80 | 'max_length' => $table[ 'max_length' ] |
|
| 81 | ) |
|
| 82 | ); |
|
| 83 | ||
| 84 | $this->getTable ( $key , $schema ) |
|
| 85 | ->addColumn ( $column ) |
|
| 86 | ->setNamespace ( |
|
| 87 | $this->config->createClassNamespace ( $this->getTable ( $key , $schema ) ) |
|
| 88 | ); |
|
| 89 | } |
|
| 90 | } |
|
| 91 | ||
| 92 | /** |
|
| 93 | * @inheritDoc |
|
| @@ 205-237 (lines=33) @@ | ||
| 202 | /** |
|
| 203 | * @inheritDoc |
|
| 204 | */ |
|
| 205 | public function parseTables () |
|
| 206 | { |
|
| 207 | if ( $this->hasTables () ) |
|
| 208 | { |
|
| 209 | return $this->getAllTables (); |
|
| 210 | } |
|
| 211 | ||
| 212 | foreach ( $this->getListColumns () as $table ) |
|
| 213 | { |
|
| 214 | $schema = $table[ 'table_schema' ]; |
|
| 215 | $key = $table [ 'table_name' ]; |
|
| 216 | if ( ! $this->hasTable ( $key , $schema ) ) |
|
| 217 | { |
|
| 218 | $this->createTable ( $key , $schema ); |
|
| 219 | } |
|
| 220 | ||
| 221 | $column = Column::getInstance () |
|
| 222 | ->populate ( |
|
| 223 | array ( |
|
| 224 | 'name' => $table [ 'column_name' ] , |
|
| 225 | 'type' => $this->convertTypeToPhp ( $table[ 'data_type' ] ) , |
|
| 226 | 'nullable' => ( $table[ 'is_nullable' ] == 'YES' ) , |
|
| 227 | 'max_length' => $table[ 'max_length' ] |
|
| 228 | ) |
|
| 229 | ); |
|
| 230 | ||
| 231 | $this->getTable ( $key , $schema ) |
|
| 232 | ->addColumn ( $column ) |
|
| 233 | ->setNamespace ( |
|
| 234 | $this->config->createClassNamespace ( $this->getTable ( $key , $schema ) ) |
|
| 235 | ); |
|
| 236 | } |
|
| 237 | } |
|
| 238 | ||
| 239 | /** |
|
| 240 | * @inheritDoc |
|