]> _ Git - cubist_cms-back.git/commitdiff
wip #3720 @1
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 22 Jun 2020 12:14:21 +0000 (14:14 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 22 Jun 2020 12:14:21 +0000 (14:14 +0200)
src/app/Magic/Fields/Email.php
src/app/Magic/Fields/Field.php
src/app/Magic/Models/CubistMagicAuthenticatable.php

index ebc75be5b0cf39aa044c18640aa06ab4631468aa..186d4ba94fae0203d00da72c0f16acf2062e2feb 100644 (file)
@@ -8,4 +8,5 @@ class Email extends Field
 {
     protected $_adminType = 'email';
     protected $_columnType = 'email';
+    protected $_databaseType = 'string';
 }
index f26d61dbc82af3b613cdf996a2c6f04cd087fe4a..30de6dc64d8ec3ccdb80df9457b0c50e47b95371 100644 (file)
@@ -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]);
         }
     }
index ca18ebfe55364bfe112d919b3ba28f13871c8de2..a0a996f95c45af07d7669dc8855a8d5ab8be0932 100644 (file)
@@ -72,6 +72,7 @@ class CubistMagicAuthenticatable extends CubistMagicAbstractModel
             'label' => 'E-mail',
             'type' => 'Email',
             'column' => true,
+            'database_unique'=>true,
             'tab' => 'Login']);
 
         $this->addField(['name' => 'password',