- Fixed the database interface
This commit is contained in:
parent
23af120020
commit
616d46cdde
|
@ -24,6 +24,8 @@ class Database implements FormInterface
|
||||||
$context->tableExist = [];
|
$context->tableExist = [];
|
||||||
|
|
||||||
foreach($this->migration->entities as $entity => $table) {
|
foreach($this->migration->entities as $entity => $table) {
|
||||||
|
$adapter = $entity::resolveEntity()->sqlAdapter()->adapter();
|
||||||
|
|
||||||
$tableName = $table->tableName();
|
$tableName = $table->tableName();
|
||||||
$databaseName = $table->databaseName();
|
$databaseName = $table->databaseName();
|
||||||
|
|
||||||
|
@ -31,14 +33,12 @@ class Database implements FormInterface
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$table = Table::repository()->where(Table::field('name'), $table->tableName())
|
$tableEntity = $adapter->schemaTable($databaseName, $tableName);
|
||||||
->where(Table::field('schema'), $table->databaseName())
|
|
||||||
->loadOne();
|
|
||||||
|
|
||||||
if ( $table ) {
|
if ( $tableEntity ) {
|
||||||
#$fields = $entiy::resolveEntity()->fieldList();
|
#$fields = $entiy::resolveEntity()->fieldList();
|
||||||
|
|
||||||
foreach($table->columns as $col) {
|
foreach($tableEntity->columns as $col) {
|
||||||
//dump( $entity::field($col->name) );
|
//dump( $entity::field($col->name) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,6 +53,7 @@ class Database implements FormInterface
|
||||||
'msg' => "unexisting",
|
'msg' => "unexisting",
|
||||||
'query' => $entity::repository()->createSqlQuery()->getSqlQuery(true),
|
'query' => $entity::repository()->createSqlQuery()->getSqlQuery(true),
|
||||||
];
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue