/** * Property select controller, starting from a given root class * * @param $parameters Parameters * - first : the root reference class name (ie a business object) * - second : if set, the selected property path into the root reference class name * @param $form array not used * @param $files array not used * @return mixed */ public function run(Parameters $parameters, $form, $files) { $class_name = Set::elementClassNameOf($parameters->shiftUnnamed()); $property_path = $parameters->shiftUnnamed(); if (empty($property_path)) { $top_property = new Property(); $top_property->class = $class_name; $properties = $this->getProperties(new Reflection_Class($class_name)); foreach ($properties as $property) { $property->path = $property->name; } } else { $top_property = new Reflection_Property($class_name, $property_path); $properties = $this->getProperties(new Reflection_Class($top_property->getType()->getElementTypeAsString()), $top_property->final_class); foreach ($properties as $property) { $property->path = $property_path . DOT . $property->name; } if (!$parameters->getRawParameter(Parameter::CONTAINER)) { $parameters->set(Parameter::CONTAINER, 'subtree'); } } $objects = $parameters->getObjects(); array_unshift($objects, $top_property); $objects['properties'] = $properties; $objects['class_name'] = $class_name; $objects['display_full_path'] = false; /** * Objects for the view : * first Property the property object (with selected property name, or not) * 'properties' Reflection_Property[] all properties from the reference class */ return View::run($objects, $form, $files, Property::class, 'select'); }
/** * @param $parameters Parameters * @param $form array * @param $files array * @param $class_name string * @return mixed */ public function run(Parameters $parameters, $form, $files, $class_name) { $sub_feature = $parameters->shiftUnnamed(); if (!$sub_feature) { $sub_feature = 'form'; } $get = $parameters->toGet(); return (new Main())->runController(View::link($class_name, Feature::F_IMPORT), $get, $form, $files, 'import' . ucfirst($sub_feature)); }