Skip to content

Commit 9c12187

Browse files
Rootieweaverryan
authored andcommitted
[make:entity] don't set array field default value for nullable column
1 parent c283524 commit 9c12187

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Util/ClassSourceManipulator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public function addEntityField(string $propertyName, array $columnOptions, array
110110
$attributes[] = $this->buildAttributeNode(Column::class, $columnOptions, 'ORM');
111111

112112
$defaultValue = null;
113-
if ('array' === $typeHint) {
113+
if ('array' === $typeHint && !$nullable) {
114114
$defaultValue = new Node\Expr\Array_([], ['kind' => Node\Expr\Array_::KIND_SHORT]);
115115
} elseif ($typeHint && '\\' === $typeHint[0] && false !== strpos($typeHint, '\\', 1)) {
116116
$typeHint = $this->addUseStatementIfNecessary(substr($typeHint, 1));

0 commit comments

Comments
 (0)