From 03a9b19f8ed0fcac9fbb04b6423828a4d8bb4452 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Thu, 3 Mar 2022 20:14:19 +0100 Subject: [PATCH] wait #5040 --- src/app/Magic/Models/CubistMagicAbstractModel.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/app/Magic/Models/CubistMagicAbstractModel.php b/src/app/Magic/Models/CubistMagicAbstractModel.php index d787671..151162b 100644 --- a/src/app/Magic/Models/CubistMagicAbstractModel.php +++ b/src/app/Magic/Models/CubistMagicAbstractModel.php @@ -48,7 +48,7 @@ class CubistMagicAbstractModel extends Model implements HasMedia public $registerMediaConversionsUsingModelInstance = true; - protected static $_doctrineTypesMapping = ['int' => 'integer','longtext'=>'text']; + protected static $_doctrineTypesMapping = ['int' => 'integer', 'longtext' => 'text']; protected $connection = null; protected $primaryKey = 'id'; @@ -750,6 +750,11 @@ class CubistMagicAbstractModel extends Model implements HasMedia return $f->filterValue($value); } + protected function _randCollectionName($fieldname) + { + return str_replace('e', 'a', substr(hash('sha256', uniqid($fieldname, true)), 0, 10)); + } + /** * @param string $fieldname * @param string|\Symfony\Component\HttpFoundation\File\UploadedFile $filepath @@ -767,7 +772,7 @@ class CubistMagicAbstractModel extends Model implements HasMedia if ($field->getAttribute('name_as_collection', false)) { $collection = $fieldname; } else { - $collection = substr(hash('sha256', uniqid($fieldname, true)), 0, 10); + $collection = $this->_randCollectionName($fieldname); } $this->setAttribute($fieldname, $collection); $save = true; -- 2.39.5