public function getEntityPath($entity, $arg1 = null, $arg2 = null, $arg3 = null) { $path = $this->entityRouter->entitySitePath($entity, $arg1, $arg2, $arg3); if (substr($path, 0, strlen($this->rubricManager->getBaseUrl())) != $this->rubricManager->getBaseUrl()) { $path = $this->rubricManager->getBaseUrl() . $path; } return $path; }
public function getEntityPath($entity, $arg1 = null, $arg2 = null, $arg3 = null) { if (!method_exists($entity, 'getSitePath')) { return 'method ' . get_class($entity) . '->getSitePath() not defined'; throw new \Exception('method ' . get_class($entity) . '->getSitePath() not defined'); } $methodData = new \ReflectionMethod($entity, 'getSitePath'); $parameters = $methodData->getParameters(); $args = array($arg1, $arg2, $arg3); if (sizeof($parameters) > 0 && $parameters[0]->getClass() && $parameters[0]->getClass()->isInstance($this->entityRouter)) { array_unshift($args, $this->entityRouter); } //Нельзя автоматом подставлять $this->rubricManager->getBaseUrl() т.к. метод getSitePath\ //может использовать entityRouter который сгенерирует путь уже с базовым урлом (app_dev.php) $path = call_user_func_array(array($entity, 'getSitePath'), $args); if (substr($path, 0, strlen($this->rubricManager->getBaseUrl())) != $this->rubricManager->getBaseUrl()) { $path = $this->rubricManager->getBaseUrl() . $path; } return $path; }
public function postPersist($object) { $this->rubricManager->clearCache(); }
public function getRubric() { // return 'Rubrica '.$this->request->get ('_rubric'); return $this->rubricManager->getCurrent(); }
public function getRubricRepo() { return $this->rubricManager->getRepository(); }