- WIP on attributes ; on testing phase

This commit is contained in:
mcndave committed 2023-01-26 13:25:59 +00:00
1 parent 5295a335b3
commit e6d0279c1a
44 files changed
+763 -142

No files matched your search

+4 -3
View File
@@ -4,6 +4,7 @@ namespace Ulmus\Migration;
use Ulmus\Adapter\AdapterInterface;
use Ulmus\Annotation\Property\Field;
use Ulmus\Attribute;
use Ulmus\Entity;
class FieldDefinition {
@@ -40,7 +41,7 @@ class FieldDefinition {
$this->type = $field->type ?? $data['type'];
$this->length = $field->length ?? null;
$this->precision = $field->precision ?? null;
$this->nullable = isset($field->nullable) ? $field->nullable : $data['nullable'];
$this->nullable = $data['nullable'] ?: $field->nullable;
$this->update = $field->attributes['update'] ?? null;
}
@@ -69,9 +70,9 @@ class FieldDefinition {
]));
}
public function getFieldTag() : ? Field
public function getFieldTag() : Field|Attribute\Property\Field|null
{
$field = array_filter($this->tags, fn($item) => $item['object'] instanceof Field);
$field = array_filter($this->tags, fn($item) => $item['object'] instanceof Field || $item['object'] instanceof Attribute\Property\Field);
return array_pop($field)['object'];
}