From: Vincent Vanwaelscappel Date: Mon, 22 Jun 2020 12:14:21 +0000 (+0200) Subject: wip #3720 @1 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=63768688c7c868a083067ca3bfc48d892d56d246;p=cubist_cms-back.git wip #3720 @1 --- diff --git a/src/app/Magic/Fields/Email.php b/src/app/Magic/Fields/Email.php index ebc75be..186d4ba 100644 --- a/src/app/Magic/Fields/Email.php +++ b/src/app/Magic/Fields/Email.php @@ -8,4 +8,5 @@ class Email extends Field { protected $_adminType = 'email'; protected $_columnType = 'email'; + protected $_databaseType = 'string'; } diff --git a/src/app/Magic/Fields/Field.php b/src/app/Magic/Fields/Field.php index f26d61d..30de6dc 100644 --- a/src/app/Magic/Fields/Field.php +++ b/src/app/Magic/Fields/Field.php @@ -114,6 +114,7 @@ class Field implements \ArrayAccess 'default' => '', 'cast' => $this->_cast, 'column_view_namespace' => $this->_columnViewNamespace, 'searchLogic' => $this->_searchLogic, 'allow_null' => true, 'can' => $this->_can, 'auth' => $this->_auth, + 'database_unique' => $this->_databaseUnique, 'database_index' => $this->_databaseIndex, 'fake' => false, 'store_in' => 'extras', 'attributes' => []]; } @@ -199,10 +200,10 @@ class Field implements \ArrayAccess CubistMagicAbstractModel::toDoctrineType($this->getDatabaseType()), $attributes ); - if ($this->_databaseUnique) { + if ($this->getAttribute('database_unique', false)) { $table->addUniqueIndex([$name]); } - if ($this->_databaseIndex) { + if ($this->getAttribute('database_index', false)) { $table->addIndex([$name]); } } diff --git a/src/app/Magic/Models/CubistMagicAuthenticatable.php b/src/app/Magic/Models/CubistMagicAuthenticatable.php index ca18ebf..a0a996f 100644 --- a/src/app/Magic/Models/CubistMagicAuthenticatable.php +++ b/src/app/Magic/Models/CubistMagicAuthenticatable.php @@ -72,6 +72,7 @@ class CubistMagicAuthenticatable extends CubistMagicAbstractModel 'label' => 'E-mail', 'type' => 'Email', 'column' => true, + 'database_unique'=>true, 'tab' => 'Login']); $this->addField(['name' => 'password',