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; }