- Migrated Entity's file into attributes

This commit is contained in:
mcndave committed 2023-03-23 15:09:42 +00:00
1 parent fa8adcace1
commit 43880eb428
4 files changed
+77 -191

No files matched your search

+11 -24
View File
@@ -4,45 +4,32 @@ namespace Ulmus\Entity\Sqlite;
use Ulmus\EntityCollection;
/**
* @Table
*/
use Ulmus\{Attribute\Obj\Table};
use Ulmus\Attribute\Property\{Field, Filter, FilterJoin, Relation, Join, Virtual, Where};
#[Table]
class Column
{
use \Ulmus\EntityTrait;
/**
* @Id
*/
#[Id]
public int $cid;
/**
* @Field
*/
#[Field]
public string $type;
/**
* @Field
*/
#[Field]
public string $name;
/**
* @Virtual
*/
#[Virtual]
public string $tableName;
/**
* @Field('name' => "notnull")
*/
#[Field(name: "notnull")]
public bool $notNull;
/**
* @Field('name' => 'dflt_value')
*/
#[Field(name: "dflt_value")]
public ? string $defaultValue;
/**
* @Field('name' => "pk")
*/
#[Field(name: "pk")]
public bool $primaryKey;
}
+10 -21
View File
@@ -4,40 +4,29 @@ namespace Ulmus\Entity\Sqlite;
use Ulmus\EntityCollection;
/**
* @Table('name' => "sqlite_master")
*/
use Ulmus\{Attribute\Obj\Table};
use Ulmus\Attribute\Property\{Field, Filter, FilterJoin, Relation, Join, Virtual, Where};
#[Table(name: "sqlite_master")]
class Schema
{
use \Ulmus\EntityTrait;
/**
* @Id
*/
#[Id]
public ? string $name;
/**
* @Field
*/
#[Field]
public ? string $type;
/**
* @Field('name' => 'tbl_name')
*/
#[Field(name: "tbl_name")]
public ? string $tableName;
/**
* @Field
*/
#[Field]
public ? int $rootpage;
/**
* @Field
*/
#[Field]
public ? string $sql;
/**
* @Relation('oneToMany', 'key' => 'tableName', 'foreignKey' => 'tableName', 'entity' => Schema::class)
*/
#[Relation("oneToMany", key: "tableName", foreignKey: "tableName", entity: "Schema")]
public EntityCollection $columns;
}