This repository has been archived on 2026-07-19. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
espocrm-base/application/Espo/Core/Container.php
T
Yuri Kuznetsov e9728454ef refactor 1 step
2013-11-08 12:05:53 +02:00

53 lines
935 B
PHP

<?php
namespace Espo\Core;
class Container
{
private $data = array();
/**
* Constructor
*/
public function __construct()
{
}
public function get($name)
{
if (!empty($this->data[$name])) {
return $this->data[$name];
}
$this->load($name);
return $this->data[$name];
}
private function load($name)
{
$loadMethod = 'load' . ucfirst($name);
if (method_exists($this, $loadMethod)) {
$this->$loadMethod();
} else {
// TODO external loader class (\Espo\Core\Loaders\EntityManager::load())
}
}
private function loadMetadata()
{
}
private function loadConfig()
{
$this->data['config'] = new \Espo\Utils\Configurator();
}
private function loadEntityManager()
{
$this->data['entityManager'] = new \Espo\Utils\EntiryManager($this->get('config'));
}
}