Skip to content

Commit

Permalink
use FieldMapping properties
Browse files Browse the repository at this point in the history
  • Loading branch information
jrushlow committed Feb 6, 2024
1 parent 030e689 commit c864411
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/Util/CSM/ClassPropertyModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,20 @@ public static function createFromObject(FieldMapping|array $data): self
throw new RuntimeCommandException('Cannot create property model - "fieldName" & "type" are required.');
}

if ($data instanceof FieldMapping) {
return new self(
propertyName: $data->fieldName,
type: $data->type,
length: $data->length,
id: $data->id ?? false,
nullable: $data->nullable ?? false,
options: $data->options ?? [],
precision: $data->precision,
scale: $data->scale,
unique: $data->unique ?? false,
);
}

return new self(
propertyName: $data['fieldName'],
type: $data['type'],
Expand Down

0 comments on commit c864411

Please sign in to comment.