replace tabs with spaces

This commit is contained in:
Yuri Kuznetsov
2014-10-20 11:13:16 +03:00
parent f062c08b31
commit dc3f6080c9
1117 changed files with 62189 additions and 62189 deletions

View File

@@ -23,70 +23,70 @@
namespace Espo\Controllers;
use \Espo\Core\Exceptions\Error,
\Espo\Core\Exceptions\Forbidden,
\Espo\Core\Exceptions\NotFound;
\Espo\Core\Exceptions\Forbidden,
\Espo\Core\Exceptions\NotFound;
class FieldManager extends \Espo\Core\Controllers\Base
{
protected function checkControllerAccess()
{
if (!$this->getUser()->isAdmin()) {
throw new Forbidden();
}
}
protected function checkControllerAccess()
{
if (!$this->getUser()->isAdmin()) {
throw new Forbidden();
}
}
public function actionRead($params, $data)
{
$data = $this->getContainer()->get('fieldManager')->read($params['name'], $params['scope']);
public function actionRead($params, $data)
{
$data = $this->getContainer()->get('fieldManager')->read($params['name'], $params['scope']);
if (!isset($data)) {
throw new NotFound();
}
if (!isset($data)) {
throw new NotFound();
}
return $data;
}
return $data;
}
public function actionCreate($params, $data)
{
if (empty($data['name'])) {
throw new Error("Field 'name' cannnot be empty");
}
public function actionCreate($params, $data)
{
if (empty($data['name'])) {
throw new Error("Field 'name' cannnot be empty");
}
$fieldManager = $this->getContainer()->get('fieldManager');
$fieldManager->create($data['name'], $data, $params['scope']);
$fieldManager = $this->getContainer()->get('fieldManager');
$fieldManager->create($data['name'], $data, $params['scope']);
try {
$this->getContainer()->get('dataManager')->rebuild($params['scope']);
} catch (Error $e) {
$fieldManager->delete($data['name'], $params['scope']);
throw new Error($e->getMessage());
}
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']);
}
return $fieldManager->read($data['name'], $params['scope']);
}
public function actionUpdate($params, $data)
{
$fieldManager = $this->getContainer()->get('fieldManager');
$fieldManager->update($params['name'], $data, $params['scope']);
public function actionUpdate($params, $data)
{
$fieldManager = $this->getContainer()->get('fieldManager');
$fieldManager->update($params['name'], $data, $params['scope']);
if ($fieldManager->isChanged()) {
$this->getContainer()->get('dataManager')->rebuild($params['scope']);
} else {
$this->getContainer()->get('dataManager')->clearCache();
}
if ($fieldManager->isChanged()) {
$this->getContainer()->get('dataManager')->rebuild($params['scope']);
} else {
$this->getContainer()->get('dataManager')->clearCache();
}
return $fieldManager->read($params['name'], $params['scope']);
}
return $fieldManager->read($params['name'], $params['scope']);
}
public function actionDelete($params, $data)
{
$res = $this->getContainer()->get('fieldManager')->delete($params['name'], $params['scope']);
public function actionDelete($params, $data)
{
$res = $this->getContainer()->get('fieldManager')->delete($params['name'], $params['scope']);
$this->getContainer()->get('dataManager')->rebuildMetadata();
$this->getContainer()->get('dataManager')->rebuildMetadata();
return $res;
}
return $res;
}
}