jsonDb supprimer init modèle données

This commit is contained in:
Fred Tempez 2020-09-18 04:10:13 +02:00
parent 0c08e387b7
commit c0aaa15ad5

View File

@ -101,6 +101,7 @@ class JsonDb extends \Prowebcraft\Dot
protected function loadData($reload = false) { protected function loadData($reload = false) {
if ($this->data === null || $reload) { if ($this->data === null || $reload) {
$this->db = $this->config['dir'] . DIRECTORY_SEPARATOR . $this->config['name']; $this->db = $this->config['dir'] . DIRECTORY_SEPARATOR . $this->config['name'];
/*
if (!file_exists($this->db)) { if (!file_exists($this->db)) {
$templateFile = $this->config['template']; $templateFile = $this->config['template'];
if (file_exists($templateFile)) { if (file_exists($templateFile)) {
@ -117,6 +118,7 @@ class JsonDb extends \Prowebcraft\Dot
} }
} }
} }
*/
$this->data = json_decode(file_get_contents($this->db), true); $this->data = json_decode(file_get_contents($this->db), true);
if (!$this->data === null) { if (!$this->data === null) {
throw new \InvalidArgumentException('Database file ' . $this->db throw new \InvalidArgumentException('Database file ' . $this->db