public function executeConsole(AgaviRequestDataHolder $request_data)
 {
     $migration_description = $request_data->getParameter('description');
     $migration_timestamp = date('YmdHis');
     $migration_slug = StringToolkit::asSnakeCase(trim($request_data->getParameter('name', 'default')));
     $migration_name = StringToolkit::asStudlyCaps($migration_slug);
     $migration_dir = $this->getAttribute('migration_dir');
     // Bit of a hack to build namespace
     if (!preg_match('#.+/app/(?:modules|migration)/(\\w+_?)(?:$|/.+)#', $migration_dir, $matches)) {
         throw new RuntimeError(sprintf('Could not find namespace info in path %s', $migration_dir));
     }
     $namespace_parts = explode('_', $matches[1]);
     if (count($namespace_parts) == 1) {
         // @todo app migration - introduce a project root namespace setting
         $namespace_parts = ['Your', 'Application'];
     }
     // And a hack to determine the technology namespace
     $target = $request_data->getParameter('target');
     if (strpos($target, 'event_source')) {
         $technology = 'CouchDb';
     } elseif (strpos($target, 'view_store')) {
         $technology = 'Elasticsearch';
     } else {
         $technology = 'RabbitMq';
     }
     $migration_filepath = sprintf('%1$s%2$s%3$s_%4$s%2$s%4$s.php', $migration_dir, DIRECTORY_SEPARATOR, $migration_timestamp, $migration_slug);
     $twig_renderer = TwigRenderer::create(['template_paths' => [__DIR__]]);
     $twig_renderer->renderToFile($technology . 'Migration.tpl.twig', $migration_filepath, ['name' => $migration_name, 'timestamp' => $migration_timestamp, 'description' => $migration_description, 'folder' => $migration_dir, 'filepath' => $migration_filepath, 'vendor_prefix' => $namespace_parts[0], 'package_prefix' => $namespace_parts[1], 'technology' => $technology, 'project_prefix' => AgaviConfig::get('core.project_prefix')]);
     return $this->cliMessage('-> migration template was created here:' . PHP_EOL . $migration_filepath . PHP_EOL);
 }
 /**
  * Creates a new generator instance.
  *
  * @param string $skeleton_name name of the skeleton
  * @param string $target_path full path to the target location (defaults to %core.module_dir%)
  * @param array $data variables to use as context for rendering via twig
  */
 public function __construct($skeleton_name, $target_path = null, array $data = [])
 {
     $required_data_keys = ['vendor', 'package'];
     foreach ($required_data_keys as $required_data_key) {
         if (!array_key_exists($required_data_key, $data)) {
             throw new RuntimeError(sprintf('A "%s" parameter must be provided', $required_data_key));
         }
     }
     $vendor = $data['vendor'];
     $package = $data['package'];
     $module_name = sprintf('%s_%s', $vendor, $package);
     if (null === $target_path) {
         $target_path = AgaviConfig::get('core.module_dir') . DIRECTORY_SEPARATOR . $module_name;
     } else {
         $target_path .= DIRECTORY_SEPARATOR . $module_name;
     }
     $data['target_path'] = $target_path;
     $data['db_prefix'] = AgaviConfig::get('core.db_prefix');
     $data['vendor_prefix'] = StringToolkit::asSnakeCase($vendor);
     $data['package_prefix'] = StringToolkit::asSnakeCase($package);
     $data['timestamp'] = date('YmdHis');
     parent::__construct($skeleton_name, $target_path, $data);
     $this->overwrite_enabled = isset($data['override_files']) ? $data['override_files'] : false;
     $this->reporting_enabled = isset($data['reporting_enabled']) ? $data['reporting_enabled'] : false;
 }
Beispiel #3
0
 /**
  * @return MigrationList
  */
 public function loadMigrations()
 {
     $migration_dir = $this->config->get('directory');
     if (!is_dir($migration_dir)) {
         throw new RuntimeError(sprintf('Given migration path is not a directory: %s', $migration_dir));
     }
     $migration_list = new MigrationList();
     $glob_expression = sprintf('%1$s%2$s[0-9]*%2$s%3$s', $migration_dir, DIRECTORY_SEPARATOR, self::GLOB_EXPRESSION);
     foreach (glob($glob_expression) as $migration_file) {
         $class_parser = new PhpClassParser();
         $migration_class_info = $class_parser->parse($migration_file);
         $migration_class = $migration_class_info->getFullyQualifiedClassName();
         if (!class_exists($migration_class)) {
             require_once $migration_class_info->getFilePath();
         }
         if (!class_exists($migration_class)) {
             throw new RuntimeError(sprintf("Unable to load migration class %s", $migration_class));
         }
         $class_name_parts = explode('_', $migration_class_info->getClassName());
         $name = $class_name_parts[2] . (isset($class_name_parts[3]) ? $class_name_parts[3] : '');
         $version = $class_name_parts[1];
         $migration = $this->injector->make($migration_class, [':state' => ['name' => StringToolkit::asSnakeCase($name), 'version' => $version]]);
         $migration_list->addItem($migration);
     }
     return $migration_list;
 }
 /**
  * Gets executed when the route of this callback is about to be reverse
  * generated into an URL.
  *
  * @param array The default parameters stored in the route.
  * @param array The parameters the user supplied to AgaviRouting::gen().
  * @param array The options the user supplied to AgaviRouting::gen().
  *
  * @return bool false as this route part should not be generated.
  *
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function onGenerate(array $default_parameters, array &$user_parameters, array &$user_options)
 {
     $ro = $this->getContext()->getRouting();
     if (array_key_exists('attribute', $user_parameters)) {
         $attribute = $user_parameters['attribute']->getValue();
         if ($attribute instanceof AttributeInterface) {
             $user_parameters['module'] = $ro->createValue(sprintf('%s-%s-%s', StringToolkit::asSnakeCase($attribute->getRootType()->getVendor()), StringToolkit::asSnakeCase($attribute->getRootType()->getPackage()), StringToolkit::asSnakeCase($attribute->getRootType()->getName())));
             return true;
         }
     }
     if (array_key_exists('resource', $user_parameters)) {
         $resource = $user_parameters['resource']->getValue();
         if ($resource instanceof EntityInterface) {
             $root_entity = $resource->getRoot() ?: $resource;
             $ro = $this->getContext()->getRouting();
             $user_parameters['module'] = $ro->createValue(sprintf('%s-%s-%s', StringToolkit::asSnakeCase($root_entity->getType()->getVendor()), StringToolkit::asSnakeCase($root_entity->getType()->getPackage()), StringToolkit::asSnakeCase($root_entity->getType()->getName())));
             return true;
         }
     }
     if (array_key_exists('module', $user_parameters)) {
         $module = $user_parameters['module']->getValue();
         if ($module instanceof EntityTypeInterface) {
             $root_type = $module->getRoot() ?: $module;
             $ro = $this->getContext()->getRouting();
             $user_parameters['module'] = $ro->createValue(sprintf('%s-%s-%s', StringToolkit::asSnakeCase($root_type->getVendor()), StringToolkit::asSnakeCase($root_type->getPackage()), StringToolkit::asSnakeCase($root_type->getName())));
             return true;
         }
     }
     // there might be a 'module' set as a string in the user parameters
     if (!array_key_exists('module', $user_parameters)) {
         throw new InvalidArgumentException('A "resource" or "module" or "attribute" user parameter instance implementing ' . 'EntityInterface, EntityTypeInterface or AttributeInterface is expected.');
     }
     return true;
 }
Beispiel #5
0
 /**
  * @return CommandBuilderInterface
  */
 public function __call($method, array $args)
 {
     if (1 === preg_match('/^with(\\w+)/', $method, $matches) && count($args) === 1) {
         $property_name = StringToolkit::asSnakeCase($matches[1]);
         $this->command_state[$property_name] = $args[0];
     }
     return $this;
 }
 protected function getWorkflowConfig(EntityTypeDefinition $entity_type_definition)
 {
     $vendor_opt = $entity_type_definition->getOptions()->filterByName('vendor');
     $package_opt = $entity_type_definition->getOptions()->filterByName('package');
     if (!$vendor_opt || !$package_opt) {
         throw new RuntimeError('Missing vendor- and/or package-option for entity-type: ' . $entity_type_definition->getName());
     }
     return ['name' => sprintf(self::WORKFLOW_NAME_PATTERN, StringToolkit::asSnakeCase($vendor_opt->getValue()), StringToolkit::asSnakeCase($package_opt->getValue()), StringToolkit::asSnakeCase($entity_type_definition->getName())), 'file' => sprintf('/%s_%s/config/%s/workflows.xml', $vendor_opt->getValue(), $package_opt->getValue(), $entity_type_definition->getName())];
 }
Beispiel #7
0
 public static function buildServiceKey(ObjectInterface $object, $service_type)
 {
     $reflection_class = new ReflectionClass($object);
     $namespace_parts = explode('\\', $reflection_class->getNamespaceName());
     if (count($namespace_parts) < 3) {
         throw new RuntimeError('Missing min. namespace-depth of 3. Unable to build a valid service-key.');
     }
     $vendor_name = array_shift($namespace_parts);
     $package_name = array_shift($namespace_parts);
     $entity_type = array_shift($namespace_parts);
     return sprintf('%s.%s.%s.%s', strtolower($vendor_name), StringToolkit::asSnakeCase($package_name), StringToolkit::asSnakeCase($entity_type), $service_type);
 }
Beispiel #8
0
 public static function getType()
 {
     $fqcn_parts = explode('\\', static::CLASS);
     if (count($fqcn_parts) < 4) {
         throw new RuntimeError(sprintf('A concrete command class must be made up of at least four namespace parts: ' . '(vendor, package, type, command), in order to support auto-type generation.' . ' The given command-class %s only has %d parts.', static::CLASS, count($fqcn_parts)));
     }
     $vendor = strtolower(array_shift($fqcn_parts));
     $package = StringToolkit::asSnakeCase(array_shift($fqcn_parts));
     $type = StringToolkit::asSnakeCase(array_shift($fqcn_parts));
     $command = str_replace('_command', '', StringToolkit::asSnakeCase(array_pop($fqcn_parts)));
     return sprintf('%s.%s.%s.%s', $vendor, $package, $type, $command);
 }
 /**
  * Gets executed when the route of this callback is about to be reverse
  * generated into an URL. It converts a given Honeybee EntityInterface
  * instance to an identifier that can be used in the generated URL.
  *
  * @param array $default_parameters default parameters stored in the route
  * @param array $user_parameters parameters the user supplied to AgaviRouting::gen()
  * @param array $user_options options the user supplied to AgaviRouting::gen()
  *
  * @return bool false when this route part should not be generated. True otherwise.
  *
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function onGenerate(array $default_parameters, array &$user_parameters, array &$user_options)
 {
     if (array_key_exists('resource', $user_parameters) && is_object($user_parameters['resource'])) {
         $resource = $user_parameters['resource']->getValue();
         if ($resource instanceof EntityInterface) {
             $root_entity = $resource->getRoot() ?: $resource;
             $ro = $this->getContext()->getRouting();
             $user_parameters['resource'] = $ro->createValue($root_entity->getIdentifier());
             $user_parameters['module'] = $ro->createValue(sprintf('%s-%s-%s', StringToolkit::asSnakeCase($root_entity->getType()->getVendor()), StringToolkit::asSnakeCase($root_entity->getType()->getPackage()), StringToolkit::asSnakeCase($root_entity->getType()->getName())));
         } else {
             $this->logDebug("Skipping invalid resource parameter. Expected instance of ", EntityInterface::CLASS);
         }
     }
     return true;
 }
 public function executeHtml(AgaviRequestDataHolder $request_data)
 {
     $this->setupHtml($request_data);
     $resource = $this->getAttribute('resource');
     $view_config_scope = $this->getAttribute('view_scope');
     $entity_short_prefix = StringToolkit::asSnakeCase($resource->getType()->getName());
     $data_ns = sprintf('create_%s', $entity_short_prefix);
     $default_settings = ['group_parts' => [$data_ns]];
     $renderer_settings = $this->getResourceRendererSettings($default_settings);
     $rendered_resource = $this->renderSubject($resource, $renderer_settings);
     $this->setAttribute('rendered_resource', $rendered_resource);
     $this->setSubheaderActivities($request_data);
     $this->setPrimaryActivities($request_data);
     $this->setAttribute('create_url', $this->routing->gen(null));
     if ($template = $this->getCustomTemplate($resource)) {
         $this->getLayer('content')->setTemplate($template);
     }
 }
 public function executeConsole(AgaviRequestDataHolder $request_data)
 {
     $fixture_timestamp = date('YmdHis');
     $fixture_slug = StringToolkit::asSnakeCase(trim($request_data->getParameter('name', 'default')));
     $fixture_name = StringToolkit::asStudlyCaps($fixture_slug);
     $fixture_dir = $this->getAttribute('fixture_dir');
     // Bit of a hack to build namespace
     if (!preg_match('#.+/app/modules/(\\w+?)/.+#', $fixture_dir, $matches)) {
         throw new RuntimeError(sprintf('Could not find namespace info in path %s', $fixture_dir));
     }
     $namespace_parts = explode('_', $matches[1]);
     $fixture_filepath = sprintf('%1$s%2$s%3$s_%4$s%2$s%4$s.php', $fixture_dir, DIRECTORY_SEPARATOR, $fixture_timestamp, $fixture_slug);
     $twig_renderer = TwigRenderer::create(['template_paths' => [__DIR__]]);
     $twig_renderer->renderToFile('Fixture.tpl.twig', $fixture_filepath, ['name' => $fixture_name, 'timestamp' => $fixture_timestamp, 'folder' => $fixture_dir, 'filepath' => $fixture_filepath, 'vendor_prefix' => $namespace_parts[0], 'package_prefix' => $namespace_parts[1]]);
     touch(sprintf('%1$s%2$s%3$s_%4$s%2$s%3$s-fixture-data.json', $fixture_dir, DIRECTORY_SEPARATOR, $fixture_timestamp, $fixture_slug));
     $fixture_files_dir = sprintf('%1$s%2$s%3$s_%4$s%2$s%5$s', $fixture_dir, DIRECTORY_SEPARATOR, $fixture_timestamp, $fixture_slug, 'files');
     mkdir($fixture_files_dir);
     return $this->cliMessage('-> fixture template was generated here:' . PHP_EOL . $fixture_filepath . PHP_EOL);
 }
 /**
  * Gets executed when the route of this callback is about to be reverse
  * generated into an URL. It converts a given Honeybee EntityInterface
  * instance to an identifier that can be used in the generated URL.
  *
  * @param array $default_parameters default parameters stored in the route
  * @param array $user_parameters parameters the user supplied to AgaviRouting::gen()
  * @param array $user_options options the user supplied to AgaviRouting::gen()
  *
  * @return bool false when this route part should not be generated. True otherwise.
  *
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function onGenerate(array $default_parameters, array &$user_parameters, array &$user_options)
 {
     if (!array_key_exists('resource', $user_parameters)) {
         throw new InvalidArgumentException('A "resource" user parameter is expected for URL generation that implements: ' . EntityInterface::CLASS);
     }
     $resource = $user_parameters['resource']->getValue();
     if ($resource instanceof EntityInterface) {
         $ro = $this->getContext()->getRouting();
         $root_entity = $resource->getRoot() ?: $resource;
         $user_parameters['resource'] = $ro->createValue($root_entity->getIdentifier());
         /*
          * @see ModuleRoutingCallback that runs later on and would get only
          * the resource identifier instead of the ProjectionInterface instance
          *
          * @todo check for EntityTypeInterface on the resource and if it has a type at all?
          */
         $user_parameters['module'] = $ro->createValue(sprintf('%s-%s-%s', StringToolkit::asSnakeCase($root_entity->getType()->getVendor()), StringToolkit::asSnakeCase($root_entity->getType()->getPackage()), StringToolkit::asSnakeCase($root_entity->getType()->getName())));
     }
     return true;
 }
 /**
  * Creates a new generator instance.
  *
  * @param string $skeleton_name name of the skeleton
  * @param string $target_path full path to the target location
  * @param array $data variables to use as context for rendering via twig
  */
 public function __construct($skeleton_name, $target_path, array $data = [])
 {
     $required_data_keys = ['vendor', 'package', 'resource', 'variant'];
     foreach ($required_data_keys as $required_data_key) {
         if (!array_key_exists($required_data_key, $data)) {
             throw new RuntimeError(sprintf('A "%s" parameter must be provided', $required_data_key));
         }
     }
     $vendor = $data['vendor'];
     $package = $data['package'];
     $resource = $data['resource'];
     $variant = $data['variant'];
     $data['target_path'] = $target_path;
     $data['db_prefix'] = AgaviConfig::get('core.db_prefix');
     $data['vendor_prefix'] = StringToolkit::asSnakeCase($vendor);
     $data['package_prefix'] = StringToolkit::asSnakeCase($package);
     $data['resource_prefix'] = StringToolkit::asSnakeCase($resource);
     $data['variant_prefix'] = StringToolkit::asSnakeCase($variant);
     $data['timestamp'] = date('YmdHis');
     parent::__construct($skeleton_name, $target_path, $data);
     $this->overwrite_enabled = isset($data['override_files']) ? $data['override_files'] : false;
     $this->reporting_enabled = isset($data['reporting_enabled']) ? $data['reporting_enabled'] : false;
 }
Beispiel #14
0
 /**
  * @return FixtureList
  */
 public function loadFixtures()
 {
     $fixture_dir = $this->config->get('directory');
     if (!is_dir($fixture_dir)) {
         throw new RuntimeError(sprintf('Given fixture path is not a directory: %s', $fixture_dir));
     }
     $fixture_list = new FixtureList();
     $glob_expression = sprintf('%1$s%2$s[0-9]*%2$s%3$s', $fixture_dir, DIRECTORY_SEPARATOR, self::GLOB_EXPRESSION);
     foreach (glob($glob_expression) as $fixture_file) {
         $class_parser = new PhpClassParser();
         $fixture_class_info = $class_parser->parse($fixture_file);
         $fixture_class = $fixture_class_info->getFullyQualifiedClassName();
         if (!class_exists($fixture_class)) {
             require_once $fixture_class_info->getFilePath();
         }
         if (!class_exists($fixture_class)) {
             throw new RuntimeError(sprintf("Unable to load fixture class %s", $fixture_class));
         }
         $class_name_parts = explode('_', $fixture_class_info->getClassName());
         $fixture = $this->service_locator->createEntity($fixture_class, [':state' => ['name' => StringToolkit::asSnakeCase($class_name_parts[2]), 'version' => $class_name_parts[1]]]);
         $fixture_list->addItem($fixture);
     }
     return $fixture_list;
 }
Beispiel #15
0
 public function getVariantPrefix()
 {
     return sprintf('%s::projection.%s', $this->getPrefix(), StringToolkit::asSnakeCase($this->getVariant()));
 }
Beispiel #16
0
 public function getType()
 {
     $event_parts = explode('\\', static::CLASS);
     $event = str_replace('_event', '', StringToolkit::asSnakeCase(array_pop($event_parts)));
     return sprintf('%s.%s', $this->projection_type, $event);
 }
Beispiel #17
0
 protected function getSubjectName($subject)
 {
     $name = '';
     if (is_null($subject)) {
         $name = 'null';
     } elseif (is_string($subject)) {
         $name = $subject;
     } else {
         $subject_name = gettype($subject);
         if (is_object($subject)) {
             $subject_class = new ReflectionClass($subject);
             $subject_name = $subject_class->getShortName();
             if ($subject instanceof ActivityInterface) {
                 $subject_name = $subject->getName() . $subject_name;
             }
         }
         $name = StringToolkit::asSnakeCase($subject_name);
     }
     return $name;
 }
Beispiel #18
0
 public function getByAggregateRootType(AggregateRootTypeInterface $aggregate_root_type, $variant = ProjectionTypeInterface::DEFAULT_VARIANT)
 {
     return $this->getItem(sprintf('%s::projection.%s', $aggregate_root_type->getPrefix(), StringToolkit::asSnakeCase($variant)));
 }
Beispiel #19
0
 public function getPrefix()
 {
     return sprintf('%s.%s', $this->getPackagePrefix(), StringToolkit::asSnakeCase($this->getName()));
 }
 protected function getTranslationDomainPrefix($join_char = '.')
 {
     $class_name_parts = explode('_', static::CLASS);
     $vendor = StringToolkit::asSnakeCase(array_shift($class_name_parts));
     $package = StringToolkit::asSnakeCase(array_shift($class_name_parts));
     $resource = StringToolkit::asSnakeCase(array_shift($class_name_parts));
     $projection_type_map = $this->getServiceLocator()->getProjectionTypeMap();
     if (!$projection_type_map->filterByPrefix($vendor . '.' . $package . '.' . $resource)) {
         return $vendor . $join_char . $package;
     } else {
         return $vendor . $join_char . $package . $join_char . $resource;
     }
 }
Beispiel #21
0
 public function asSnakeCase($value)
 {
     return StringToolkit::asSnakeCase($value);
 }
 protected function getProjectionType()
 {
     if ($this->resource_type) {
         return $this->resource_type;
     }
     if (!$this->hasParameter('resource_type')) {
         throw new RuntimeError('Missing required "resource_type" parameter.');
     }
     $variant = $this->getData('variant');
     $variant = $variant ?: ProjectionTypeInterface::DEFAULT_VARIANT;
     $projection_variant_prefix = sprintf('%s::projection.%s', $this->getParameter('resource_type'), StringToolkit::asSnakeCase($variant));
     $projection_type_map = $this->getServiceLocator()->getProjectionTypeMap();
     if (!$projection_type_map->hasKey($projection_variant_prefix)) {
         return false;
     }
     $this->resource_type = $projection_type_map->getItem($projection_variant_prefix);
     return $this->resource_type;
 }
 protected function getAsSnakeCase($string)
 {
     return StringToolkit::asSnakeCase($string);
 }
 protected function appendHoneybeeConsoleRouting(DOMDocument $document, DOMElement $parent_node, $honeybee_module)
 {
     $meta_data = $this->getModuleMetaData($honeybee_module);
     if (!$meta_data) {
         throw new RuntimeError('Missing meta-data file for suspected honeybee-module ' . $honeybee_module);
     }
     $vendor_prefix = StringToolkit::asSnakeCase($meta_data['vendor']);
     $package_prefix = StringToolkit::asSnakeCase($meta_data['package']);
     $module_config_dir = sprintf('%s/%s/config', AgaviConfig::get('core.module_dir'), $honeybee_module);
     $module_routing_file = $module_config_dir . '/routing.xml';
     $routing_finder = Finder::create()->files()->name('routing.xml')->sortByName()->in($module_config_dir);
     foreach ($routing_finder as $routing_file) {
         if ($routing_file->getPathname() === $module_routing_file) {
             continue;
             // exclude app/modules/[module_name]/routing.xml
         }
         $resource_name = basename($routing_file->getPath());
         $resource_prefix = StringToolkit::asSnakeCase($resource_name);
         $route_pattern = sprintf('^%s.%s.%s.', $vendor_prefix, $package_prefix, $resource_prefix);
         $route_name = sprintf('%s.%s.%s', $vendor_prefix, $package_prefix, $resource_prefix);
         $entity_type_route = $document->createElement('route');
         $entity_type_route->setAttribute('name', $route_name);
         $entity_type_route->setAttribute('pattern', $route_pattern);
         $entity_type_route->setAttribute('module', $honeybee_module);
         $entity_type_route->setAttribute('action', $resource_name);
         $xi_include = $document->createElement('xi:include');
         $relative_href = str_replace(AgaviConfig::get('core.app_dir'), '../..', $routing_file->getPathname());
         $xi_include->setAttribute('href', $relative_href);
         $xi_include->setAttribute('xpointer', "xmlns(ae=http://agavi.org/agavi/config/global/envelope/1.0) " . "xmlns(r=http://agavi.org/agavi/config/parts/routing/1.0) " . "xpointer(//ae:configuration[@context='console']/*)");
         $routes_node = $document->createElement('routes');
         $routes_node->appendChild($xi_include);
         $entity_type_route->appendChild($routes_node);
         $parent_node->appendChild($entity_type_route);
     }
     $route_pattern = sprintf('^%s.%s', $vendor_prefix, $package_prefix);
     $route_name = sprintf('%s.%s', $vendor_prefix, $package_prefix);
     $package_route = $document->createElement('route');
     $package_route->setAttribute('name', $route_name);
     $package_route->setAttribute('pattern', $route_pattern);
     $package_route->setAttribute('module', $honeybee_module);
     $xi_include = $document->createElement('xi:include');
     $relative_href = str_replace(AgaviConfig::get('core.app_dir'), '../..', $module_routing_file);
     $xi_include->setAttribute('href', $relative_href);
     $xi_include->setAttribute('xpointer', "xmlns(ae=http://agavi.org/agavi/config/global/envelope/1.0) " . "xmlns(r=http://agavi.org/agavi/config/parts/routing/1.0) " . "xpointer(//ae:configuration[@context='console']/*)");
     $routes_node = $document->createElement('routes');
     $routes_node->appendChild($xi_include);
     $package_route->appendChild($routes_node);
     $parent_node->appendChild($package_route);
     return $package_route;
 }
 /**
  * Returns the (Standard) projection type for the current action. This depends on the class name.
  *
  * @param string $variant name of projection type variant (defaults to 'Standard')
  *
  * @return ProjectionTypeInterface
  */
 protected function getProjectionType($variant = ProjectionTypeInterface::DEFAULT_VARIANT)
 {
     $class_name_parts = explode('_', static::CLASS);
     $vendor = array_shift($class_name_parts);
     $package = array_shift($class_name_parts);
     $entity_type = array_shift($class_name_parts);
     $variant_prefix = sprintf('%s.%s.%s::projection.%s', StringToolkit::asSnakeCase($vendor), StringToolkit::asSnakeCase($package), StringToolkit::asSnakeCase($entity_type), StringToolkit::asSnakeCase($variant));
     return $this->getServiceLocator()->getProjectionTypeMap()->getItem($variant_prefix);
 }