/** * @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_does_not_have_grid_unless_defined_as_in_parameters(Parameters $parameters) { $parameters->has('grid')->willReturn(false); $this->shouldNotHaveGrid(); $parameters->has('grid')->willReturn(true); $this->shouldHaveGrid(); $parameters->has('grid')->willReturn(true); $parameters->get('grid')->willReturn('sylius_admin_tax_category'); $this->getGrid()->shouldReturn('sylius_admin_tax_category'); }
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', []); }