entity manager dev

This commit is contained in:
yuri
2015-01-21 15:13:37 +02:00
parent b73ca3f1bc
commit fff1be9d07
12 changed files with 100 additions and 215 deletions
@@ -66,6 +66,11 @@ class EntityManager extends \Espo\Core\Controllers\Base
$result = $this->getContainer()->get('entityManagerUtil')->create($name, $type, $params);
if ($result) {
$tabList = $this->getConfig()->get('tabList', []);
$tabList[] = $name;
$this->getConfig()->set('tabList', $tabList);
$this->getConfig()->save();
$this->getContainer()->get('dataManager')->rebuild();
} else {
throw new Error();
@@ -92,6 +97,14 @@ class EntityManager extends \Espo\Core\Controllers\Base
$result = $this->getContainer()->get('entityManagerUtil')->delete($name);
if ($result) {
$tabList = $this->getConfig()->get('tabList', []);
if (($key = array_search($name, $tabList)) !== false) {
unset($tabList[$key]);
$tabList = array_values($tabList);
}
$this->getConfig()->set('tabList', $tabList);
$this->getConfig()->save();
$this->getContainer()->get('dataManager')->clearCache();
} else {
throw new Error();