- Multiple bug fixes related to notes 2.x

This commit is contained in:
Dave Mc Nicoll committed 2024-05-31 12:26:39 +00:00
1 parent f3be11a590
commit bd9078230d
9 files changed
+69 -73

No files matched your search

+6 -6
View File
@@ -20,13 +20,13 @@ class DatasetHandler
public function pull(object $entity) : Generator
{
foreach($this->entityResolver->fieldList(EntityResolver::KEY_ENTITY_NAME, true) as $key => $field) {
$annotation = $this->entityResolver->searchFieldAnnotation($key,[ Field::class ]);
$attribute = $this->entityResolver->searchFieldAnnotation($key,[ Field::class ]);
if ( $entity->__isset($key) ) {
yield $annotation->name ?? $key => $entity->$key;
yield $attribute->name ?? $key => $entity->$key;
}
elseif ( $field->allowsNull() ) {
yield $annotation->name ?? $key => null;
yield $attribute->name ?? $key => null;
}
}
}
@@ -77,10 +77,10 @@ class DatasetHandler
elseif ( EntityField::isScalarType($type->type) ) {
if ( $type->type === 'string' ) {
$annotation = $this->entityResolver->searchFieldAnnotation($field->name, [ Field::class ] );
$attribute = $this->entityResolver->searchFieldAnnotation($field->name, [ Field::class ] );
if ( $annotation->length ?? null ) {
$value = mb_substr($value, 0, $annotation->length);
if ( $attribute->length ?? null ) {
$value = mb_substr($value, 0, $attribute->length);
}
}
elseif ( $type->type === 'bool' ) {