/** * Loads all children from this path * * @param int path The path id to load and to get the children from */ protected function load($path) { try { $path = $this->mapper->find($path); foreach(get_class_vars(get_class($path)) as $property => $v) { $this->{$property} = call_user_func(array($path, 'get' . ucfirst($property))); } } catch (\Exception $e) { } }
/** * Delete a section container and optionally moves the contents into a different folder * * @param string $guid The ID of the path to delete * * @return JSONResponse * * @NoAdminRequired */ public function sectionDelete($guid) { try { // Check for a valid post data format $data = (object) $this->request->post; if (!is_object($data) || !isset($data->section)) { throw new \Exception('Invalid data posted for remove a section in SecureContainer.'); } $move = !isset($data->moveToTrash) || $data->moveToTrash == !false; if ($this->pathMapper->exists($guid)) { $entity = $this->pathMapper->find($guid); $this->deletePathEntry($entity, $move); } else { throw new \Exception('Invalid Path-ID ' . $guid . ' given to delete.'); } // Create the response $response = $this->getResponseSkeleton('section'); $this->appendNavigationEvent('delete', array('id' => $guid), $response); } catch (\Exception $ex) { return $this->createResponseException($ex, 'section', Http::STATUS_INTERNAL_SERVER_ERROR); } return new JSONResponse($response); }