Skip to content

Commit

Permalink
Merge pull request #115 from tailflow/next
Browse files Browse the repository at this point in the history
v2.1.4 Release
  • Loading branch information
alexzarbn authored Jul 19, 2021
2 parents 07b6465 + 2a3f5de commit 33a1d61
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/Specs/Builders/PropertyBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public function build(Column $column, string $concretePropertyClass): SchemaProp
/** @var SchemaProperty $property */
$property = new $concretePropertyClass();
$property->name = $column->getName();
$property->nullable = !$column->getNotnull();

return $property;
}
Expand Down
10 changes: 9 additions & 1 deletion src/ValueObjects/Specs/Schema/SchemaProperty.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,19 @@ class SchemaProperty implements Arrayable
public $name;
/** @var string */
public $type;
/** @var bool */
public $nullable = false;

public function toArray(): array
{
return [
$descriptor = [
'type' => $this->type,
];

if ($this->nullable) {
$descriptor['nullable'] = true;
}

return $descriptor;
}
}

0 comments on commit 33a1d61

Please sign in to comment.