mirror of
https://github.com/espocrm/espocrm.git
synced 2026-06-28 06:56:05 +00:00
fixed FieldManager bug, when rebuild exception
This commit is contained in:
@@ -55,7 +55,12 @@ class FieldManager extends \Espo\Core\Controllers\Base
|
||||
$fieldManager = $this->getContainer()->get('fieldManager');
|
||||
$fieldManager->create($data['name'], $data, $params['scope']);
|
||||
|
||||
$this->getContainer()->get('dataManager')->rebuild($params['scope']);
|
||||
try {
|
||||
$this->getContainer()->get('dataManager')->rebuild($params['scope']);
|
||||
} catch (Error $e) {
|
||||
$fieldManager->delete($data['name'], $params['scope']);
|
||||
throw new Error($e->getMessage());
|
||||
}
|
||||
|
||||
return $fieldManager->read($data['name'], $params['scope']);
|
||||
}
|
||||
|
||||
@@ -22,7 +22,8 @@
|
||||
|
||||
namespace Espo\Core\Utils;
|
||||
|
||||
use \Espo\Core\Exceptions\Error;
|
||||
use \Espo\Core\Exceptions\Error,
|
||||
\Espo\Core\Exceptions\Conflict;
|
||||
|
||||
class FieldManager
|
||||
{
|
||||
@@ -74,7 +75,7 @@ class FieldManager
|
||||
{
|
||||
$existingField = $this->getFieldDef($name, $scope);
|
||||
if (isset($existingField)) {
|
||||
throw new Error('Field ['.$name.'] exists in '.$scope);
|
||||
throw new Conflict('Field ['.$name.'] exists in '.$scope);
|
||||
}
|
||||
|
||||
return $this->update($name, $fieldDef, $scope);
|
||||
|
||||
Reference in New Issue
Block a user