public function getRoute() { $rt = ''; $parents = Categories::getHierarchy($this->id); foreach ($parents as $p) { $rt = ($p->alias !== '0' ? $p->alias . '/' : '') . $rt; } return $rt; }
private function getCategoryPath($id) { $parents = Categories::getHierarchy($id); if (!count($parents)) { $path = '#wct-' . $id; } $path = ''; foreach ($parents as $p) { $path = $p->alias . '/' . $path; } return $path; }
private function createHierarchyPath() { $o = $this->owner; if ($o instanceof Resources) { $path = $o->alias; $cat_id = $o->category_id; } elseif ($o instanceof Categories) { $path = ''; $cat_id = $o->id; } else { throw new InvalidCallException("Неправильный тип объекта"); } $parents = Categories::getHierarchy($cat_id); foreach ($parents as $p) { $path = $p->alias . '/' . $path; } return $path; }