fixed FieldManager bug, when rebuild exception

This commit is contained in:
Taras Machyshyn
2014-06-02 17:19:09 +03:00
parent defa3b5cfc
commit 60b11cb11e
2 changed files with 9 additions and 3 deletions

View File

@@ -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']);
}