- Added limitation on fixedValue in Where attribute

This commit is contained in:
Dave Mc Nicoll committed 2024-12-09 16:40:50 +00:00
1 parent 1fac12c928
commit 589524ca3a
5 files changed
+28 -19

No files matched your search

+8 -2
View File
@@ -5,7 +5,7 @@ namespace Ulmus\Entity\InformationSchema;
use Ulmus\EntityCollection,
Ulmus\Entity\Field\Datetime;
use Ulmus\{Attribute\Obj\Table as TableObj};
use Ulmus\{Attribute\Obj\Table as TableObj, Entity\EntityInterface};
use Ulmus\Attribute\Property\{Field, Filter, FilterJoin, Relation, Join, Virtual, Where};
#[TableObj(name: "tables", database: "information_schema")]
@@ -83,6 +83,12 @@ class Table
public ? string $temporary;
#[Relation(type: "oneToMany", key: "name", foreignKey: [ Column::class, 'tableName' ], entity: Column::class)]
#[Where('TABLE_SCHEMA', fieldValue: [ Column::class, 'tableSchema' ])]
#[Where(field: 'TABLE_SCHEMA', generateValue: [ Table::class, 'getSchema' ])]
public EntityCollection $columns;
# Awaiting PHP 8.5 https://wiki.php.net/rfc/closures_in_const_expr
public static function getSchema(Table $entity) : string
{
return $entity->schema;
}
}
+1 -1
View File
@@ -12,6 +12,6 @@ use Ulmus\Attribute\Property\{Field, Filter, FilterJoin, Relation, Join, Virtual
class Table extends \Ulmus\Entity\InformationSchema\Table
{
#[Relation(type: "oneToMany", key: "name", foreignKey: [ Column::class, 'tableName' ], entity: Column::class)]
#[Where('TABLE_SCHEMA', fieldValue: [ Column::class, 'tableSchema' ])]
#[Where('TABLE_SCHEMA', generateValue: [ Table::class, 'getSchema' ])]
public EntityCollection $columns;
}