public function getRoutePath(array &$requirements_entitys, array &$requirements, array &$requirement_keys, \Symforce\AdminBundle\Compiler\Generator\PhpWriter $generator, \Symforce\AdminBundle\Compiler\Generator\PhpWriter $dispatcher, $with_entity, $path, $break_requirement_key = null, $first_entity_call = true) { $entity_object_name = '$' . $this->admin_name; if ($with_entity) { $requirements_entitys[$this->admin_class] = $this->eneity_id_name; if ($this->admin->getPropertySlugName()) { if ($this->admin->isPropertySlugNullable()) { $requirements[$this->eneity_id_name] = '\\w*'; } else { $requirements[$this->eneity_id_name] = '\\w+'; } } else { $requirements[$this->eneity_id_name] = '\\d+'; } $property_slug_name = $this->admin->getPropertyIdName(); $property_id_name = $this->admin->getPropertySlugName(); if (!empty($property_slug_name)) { $generator->writeln(sprintf('$options["%s"] = $accessor->getValue(%s, "%s");', $this->eneity_id_name, $entity_object_name, $property_slug_name)); $generator->writeln(sprintf('if( empty($options["%s"]) ) $options["%s"] = $accessor->getValue(%s, "%s");', $this->eneity_id_name, $this->eneity_id_name, $entity_object_name, $property_id_name)); } else { $generator->writeln(sprintf('$options["%s"] = $accessor->getValue(%s, "%s");', $this->eneity_id_name, $entity_object_name, $property_id_name)); } if ($first_entity_call) { $first_entity_call = false; $dispatcher->writeln(sprintf('%s = $controller->getPageObject("%s", $request->get("%s") );', $entity_object_name, $this->admin_name, $this->eneity_id_name)); } else { $dispatcher->writeln(sprintf('$controller->setPageObject(%s, "%s", $request->get("%s") );', $entity_object_name, $this->admin_name, $this->eneity_id_name)); } } if (!$first_entity_call) { if (!isset($requirement_keys[$this->eneity_id_name])) { if ($break_requirement_key) { if ($with_entity) { $path = '/' . $this->route_path . '/' . '{' . $this->eneity_id_name . '}' . $path; } else { $path = '/' . $this->route_path . $path; } } } else { if ($break_requirement_key) { // throw new \Exception(sprintf("%s: `{%s}` duplicate, maybe you missing `{%s}` in path `%s`", $this->err_msg, $this->eneity_id_name, $break_requirement_key, $path )); } } } if ($this->page_parent_entity) { $parent_entity_object_name = '$' . $this->parent_admin->getName(); if ($with_entity) { $generator->writeln(sprintf('%s = $accessor->getValue(%s, "%s");', $parent_entity_object_name, $entity_object_name, $this->property_page_name)); } $parent_generator = $this->page_loader->getPageGeneratorByClass($this->page_parent_entity); if (!$first_entity_call) { $dispatcher->writeln(sprintf('%s = $accessor->getValue(%s, "%s");', $parent_entity_object_name, $entity_object_name, $this->property_page_name)); } if (!$break_requirement_key && !isset($requirement_keys[$this->eneity_id_name])) { $break_requirement_key = $this->eneity_id_name; } $path = $parent_generator->getRoutePath($requirements_entitys, $requirements, $requirement_keys, $generator, $dispatcher, true, $path, $break_requirement_key, $first_entity_call); } return $path; }