From 9c31cbf7dd04aa6e74c307ad6187a9b5e4b2ac43 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Thu, 6 Jun 2019 17:01:44 +0200 Subject: [PATCH] #2810 --- src/app/Magic/Fields/Field.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/app/Magic/Fields/Field.php b/src/app/Magic/Fields/Field.php index bf5e023..4f5e15d 100644 --- a/src/app/Magic/Fields/Field.php +++ b/src/app/Magic/Fields/Field.php @@ -66,7 +66,9 @@ class Field { return ['type' => $this->_adminType, 'column' => false, 'form' => 'both', 'rules' => '', 'fillable' => true, 'guarded' => false, 'hidden' => false, 'translatable' => $this->_translatable, - 'column_type' => $this->_columnType, 'default' => '', 'cast' => $this->_cast, 'fake' => false, 'store_in' => false]; + 'column_type' => $this->_columnType, 'default' => '', 'cast' => $this->_cast, + 'allow_null' => true, + 'fake' => false, 'store_in' => false]; } public function __construct($attributes) @@ -121,7 +123,12 @@ class Field public function defineDbColumn($table) { $name = $this->getAttribute('name'); - $table->addColumn($name, CubistMagicAbstractModel::toDoctrineType($this->getDatabaseType()), $this->_databaseAttributes); + $table->addColumn($name, + CubistMagicAbstractModel::toDoctrineType($this->getDatabaseType()), + array_merge( + ['allow_null' => $this->getAttribute('allow_null', true)], + $this->_databaseAttributes) + ); if ($this->_databaseUnique) { $table->addUniqueIndex([$name]); } -- 2.39.5