/** * Loads all children if they are not loaded yet */ protected function loadChildren() { if (!$this->loaded && $this->getId() > 0) { $this->children = $this->mapper->findPathTree($this->getId()); $this->loaded = true; } }
/** * Removes all path entries and the contents recursively * * @param \OCA\secure_container\Db\Path $path Path to delete * @param boolean $move Move the entries to the trash instead of delete */ private function deletePathEntry($path, $move) { // Get all path children and walk down to begin the delete process on deepest level $children = $this->pathMapper->findChildren($path->getId()); foreach ($children as $child) { $this->deletePathEntry($child, $move); } // Delete all entries in this path and finally delete the path itself $entries = $this->contentMapper->findAll($path->getId()); foreach ($entries as $entry) { if ($move) { $entry->setPath(self::TRASH_PARENT_ID); $this->contentMapper->update($entry); } else { $this->contentMapper->delete($entry); } } $this->pathMapper->delete($path); }