From: Vincent Vanwaelscappel Date: Thu, 6 Jun 2019 15:01:44 +0000 (+0200) Subject: #2810 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=9c31cbf7dd04aa6e74c307ad6187a9b5e4b2ac43;p=cubist_cms-back.git #2810 --- 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]); }