- WIp on Migration for mssql
This commit is contained in:
1 parent
fb4985160a
commit
c719e4a6d1
4 files changed
+33
-6
No files matched your search
@@ -2,11 +2,23 @@
|
||||
|
||||
namespace Ulmus\Entity\Mssql;
|
||||
|
||||
use Ulmus\Attribute\Obj\Table as TableObj;
|
||||
use Ulmus\Attribute\Property\Field;
|
||||
use Ulmus\ConnectionAdapter;
|
||||
use Ulmus\Entity\Mysql\id;
|
||||
use Ulmus\Repository;
|
||||
use Ulmus\Ulmus;
|
||||
|
||||
#[TableObj(name: "columns", schema: "information_schema")]
|
||||
class Column extends \Ulmus\Entity\InformationSchema\Column
|
||||
{
|
||||
/*
|
||||
public static function repository(string $alias = Repository::DEFAULT_ALIAS, ConnectionAdapter $adapter = null): Repository
|
||||
{
|
||||
$adapter = Ulmus::$registeredAdapters[$this->loadedFromAdapter];
|
||||
|
||||
return Ulmus::repository(static::class, $alias, $adapter);
|
||||
}*/
|
||||
|
||||
# TODO ! Handle FUNCTIONAL default value
|
||||
protected function canHaveDefaultValue(): bool
|
||||
|
||||
@@ -5,13 +5,22 @@ namespace Ulmus\Entity\Mssql;
|
||||
use Ulmus\EntityCollection,
|
||||
Ulmus\Entity\Field\Datetime;
|
||||
|
||||
use Ulmus\{Attribute\Obj\Table as TableObj,};
|
||||
use Ulmus\{Attribute\Obj\Table as TableObj, Ulmus};
|
||||
use Ulmus\Attribute\Property\{Field, Filter, FilterJoin, Relation, Join, Virtual, Where};
|
||||
use Ulmus\Repository;
|
||||
|
||||
#[TableObj(name: "tables", database: "information_schema")]
|
||||
#[TableObj(name: "tables", schema: "information_schema")]
|
||||
class Table extends \Ulmus\Entity\InformationSchema\Table
|
||||
{
|
||||
#[Relation(type: "oneToMany", key: "name", foreignKey: [ Column::class, 'tableName' ], entity: Column::class)]
|
||||
#[Where('TABLE_SCHEMA', generateValue: [ Table::class, 'getSchema' ])]
|
||||
##[Filter(method: "filterColumns")]
|
||||
public EntityCollection $columns;
|
||||
|
||||
public function filterColumns() : Repository
|
||||
{
|
||||
$adapter = Ulmus::$registeredAdapters[$this->loadedFromAdapter];
|
||||
|
||||
return Column::repository(Repository\MssqlRepository::DEFAULT_ALIAS, $adapter);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user