From 26ff19a7aff886f8bdadd683d99dd116844ce215 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josef=20K=C5=99=C3=AD=C5=BE?= Date: Sun, 12 Jan 2014 17:51:51 +0100 Subject: [PATCH] RouteEntity: Create dir in getDir method. --- CmsModule/Content/Entities/RouteEntity.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/CmsModule/Content/Entities/RouteEntity.php b/CmsModule/Content/Entities/RouteEntity.php index 7b5a5503..5546e5df 100644 --- a/CmsModule/Content/Entities/RouteEntity.php +++ b/CmsModule/Content/Entities/RouteEntity.php @@ -297,11 +297,6 @@ public function __construct(PageEntity $page, $type) $this->cacheMode = self::DEFAULT_CACHE_MODE; $this->created = new \DateTime; $this->released = new \DateTime; - - $this->dir = new DirEntity; - $this->dir->setParent($this->page->getDir()); - $this->dir->setInvisible(TRUE); - $this->dir->setName(Strings::webalize(get_class($this)) . Strings::random()); } @@ -985,6 +980,13 @@ public function getLocale() */ public function getDir() { + if (!$this->dir) { + $this->dir = new DirEntity; + $this->dir->setParent($this->page->getDir()); + $this->dir->setInvisible(TRUE); + $this->dir->setName(Strings::webalize(get_class($this)) . Strings::random()); + } + return $this->dir; }