/** * @param ResourceController $controller * @param Request $request */ private function processRequest(ResourceController $controller, Request $request) { $parameters = array_merge($this->settings, $this->parseApiData($request)); list($parameters, $parameterNames) = $this->parametersParser->parse($parameters, $request); $this->parameters->replace($parameters); $this->parameters->set('paramater_name', $parameterNames); $controller->getConfiguration()->setRequest($request); $controller->getConfiguration()->setParameters($this->parameters); $routeParams = $request->attributes->get('_route_params', array()); if (isset($routeParams['_sylius'])) { unset($routeParams['_sylius']); $request->attributes->set('_route_params', $routeParams); } }
/** * @return string * * @throws \LogicException */ public function getGrid() { if (!$this->hasGrid()) { throw new \LogicException('Current action does not use grid.'); } return $this->parameters->get('grid'); }
/** * @param string $key * * @return string */ private function getParameterName($key) { $parameterName = $this->parameters->get('parameter_name'); if (isset($parameterName[$key]) && !is_array($parameterName[$key])) { return $parameterName[$key]; } return $key; }
/** * @return bool */ public function isHeaderRedirection() { $redirect = $this->parameters->get('redirect'); if (!is_array($redirect) || !isset($redirect['header'])) { return false; } if ('xhr' === $redirect['header']) { return $this->getRequest()->isXmlHttpRequest(); } return (bool) $redirect['header']; }
public function getSerializationVersion() { return $this->parameters->get('serialization_version'); }
public function getPermission($default = null) { return $this->parameters->get('permission', $default); }
function it_throws_an_exception_when_trying_to_retrieve_undefined_grid(Parameters $parameters) { $parameters->has('grid')->willReturn(false); $this->shouldThrow(\LogicException::class)->during('getGrid'); }
function it_has_section(Parameters $parameters) { $parameters->get('section')->willReturn(null); $this->getSection()->shouldReturn(null); $parameters->get('section')->willReturn('admin'); $this->getSection()->shouldReturn('admin'); }
function it_can_have_state_machine_transition(Parameters $parameters) { $parameters->has('state_machine')->willReturn(false); $this->hasStateMachine()->shouldReturn(false); $parameters->has('state_machine')->willReturn(true); $parameters->get('state_machine[graph]', null, true)->willReturn('sylius_product_review_state'); $parameters->get('state_machine[transition]', null, true)->willReturn('approve'); $this->hasStateMachine()->shouldReturn(true); $this->getStateMachineGraph()->shouldReturn('sylius_product_review_state'); $this->getStateMachineTransition()->shouldReturn('approve'); }
function it_has_sortable_position_parameter(Parameters $parameters) { $parameters->get('sortable_position', 'position')->willReturn('position'); $this->getSortablePosition()->shouldReturn('position'); $parameters->get('sortable_position', 'position')->willReturn('myPosition'); $this->getSortablePosition()->shouldReturn('myPosition'); }
/** * @return string|null */ private function getSection() { return $this->parameters->get('section'); }
/** * @return bool */ public function isCsrfProtectionEnabled() { return $this->parameters->get('csrf_protection', true); }
/** * @return string */ public function getStateMachineTransition() { return $this->parameters->get('state_machine[transition]', null, true); }
public function getBatches() { return $this->parameters->get('batches', []); }