diff --git a/Admin/CRUD/Context/FormElementContext.php b/Admin/CRUD/Context/FormElementContext.php
index 009fc1a7..5c808ba9 100644
--- a/Admin/CRUD/Context/FormElementContext.php
+++ b/Admin/CRUD/Context/FormElementContext.php
@@ -84,7 +84,7 @@ protected function supportsElement(Element $element): bool
*/
private function getObject(Request $request)
{
- $id = $request->get('id');
+ $id = $request->attributes->get('id');
if (null === $id || '' === $id) {
$this->checkAllowAddOption();
return null;
diff --git a/Admin/DependentElementImpl.php b/Admin/DependentElementImpl.php
index 7a6ec793..9781b13f 100644
--- a/Admin/DependentElementImpl.php
+++ b/Admin/DependentElementImpl.php
@@ -67,6 +67,11 @@ protected function getParentObjectId(): ?string
return null;
}
- return $currentRequest->get(DependentElement::PARENT_REQUEST_PARAMETER);
+ $parentObjectId = $currentRequest->query->get(DependentElement::PARENT_REQUEST_PARAMETER);
+ if (null === $parentObjectId) {
+ return null;
+ }
+
+ return (string) $parentObjectId;
}
}
diff --git a/Admin/Display/Context/DisplayContext.php b/Admin/Display/Context/DisplayContext.php
index abb9d8ea..1192d1a2 100644
--- a/Admin/Display/Context/DisplayContext.php
+++ b/Admin/Display/Context/DisplayContext.php
@@ -86,7 +86,7 @@ protected function supportsElement(Element $element): bool
*/
private function getObject(Request $request)
{
- $id = $request->get('id');
+ $id = $request->attributes->get('id');
return $this->element->getDataIndexer()->getData($id);
}
diff --git a/EventSubscriber/TranslationLocaleMenuSubscriber.php b/EventSubscriber/TranslationLocaleMenuSubscriber.php
index c055ca91..2504d27c 100644
--- a/EventSubscriber/TranslationLocaleMenuSubscriber.php
+++ b/EventSubscriber/TranslationLocaleMenuSubscriber.php
@@ -130,7 +130,7 @@ private function createRootItem(bool $isCurrentElementTranslatable): Item
private function populateTranslationLocaleMenu(Item $menu): void
{
$requestParameters = $this->getRequestParameters();
- $route = $this->getRequest()->get('_route');
+ $route = $this->getRequest()->attributes->get('_route');
if (true === array_key_exists('redirect_uri', $requestParameters)) {
$redirectRequest = $this->createRedirectRequest($requestParameters['redirect_uri']);
@@ -241,7 +241,7 @@ private function localeToLangaugeName(string $locale): string
private function getRequestParameters(): array
{
return array_merge(
- $this->getRequest()->get('_route_params'),
+ $this->getRequest()->attributes->get('_route_params'),
$this->getRequest()->query->all()
);
}
diff --git a/Resources/doc/embedding_element.md b/Resources/doc/embedding_element.md
index 04fc00cc..9d05ede9 100644
--- a/Resources/doc/embedding_element.md
+++ b/Resources/doc/embedding_element.md
@@ -428,7 +428,7 @@ class UserListener
public function userEditPostCreate(FormEvent $event)
{
if ($event->getElement()->getId() === 'users') {
- $this->invoicesDatasource = $event->getRequest()->get('invoices_datasource', array());
+ $this->invoicesDatasource = $event->getRequest()->query->all('invoices_datasource', array());
}
}
diff --git a/Resources/views/CRUD/datagrid.html.twig b/Resources/views/CRUD/datagrid.html.twig
index bcdc65de..3fa62c15 100644
--- a/Resources/views/CRUD/datagrid.html.twig
+++ b/Resources/views/CRUD/datagrid.html.twig
@@ -1,5 +1,4 @@
{% block datagrid %}
-{% apply spaceless %}
{{ datagrid_header_widget(datagrid) }}
@@ -8,11 +7,9 @@
{{ datagrid_rowset_widget(datagrid) }}
-{% endapply %}
{% endblock %}
{% block datagrid_column_cell %}
-{% apply spaceless %}
{{ block('datagrid_column_cell_form_link') }}
@@ -21,7 +18,6 @@
-{% endapply %}
{% endblock %}
{% block datagrid_column_cell_form_link %}
@@ -49,7 +45,6 @@
{%- endblock datagrid_column_cell_form_popover -%}
{% block datagrid_column_cell_form %}
-{% apply spaceless %}
{% form_theme form '@FSiAdmin/CRUD/datagrid_edit_form.html.twig' %}
{{ form_start(form) }}
{{ form_widget(form) }}
@@ -57,26 +52,22 @@
{{ form_end(form) }}
-{% endapply %}
{% endblock %}
{% block datagrid_column_header %}
- {% apply spaceless %}
-
- {{ header.getAttribute('label')|trans({}, translation_domain) }}
- {% if vars.datasource is defined and vars.datasource[header.name] is defined %}
- {% set filter = vars.datasource[header.name] %}
- {% if filter.getAttribute('sortable') == true %}
- {{ datasource_sort_widget(filter) }}
- {% endif %}
+
+ {{ header.getAttribute('label')|trans({}, translation_domain) }}
+ {% if vars.datasource is defined and vars.datasource[header.name] is defined %}
+ {% set filter = vars.datasource[header.name] %}
+ {% if filter.getAttribute('sortable') == true %}
+ {{ datasource_sort_widget(filter) }}
{% endif %}
-
- {% endapply %}
+ {% endif %}
+
{% endblock %}
{# pattern: datagrid_{grid_name}_column_name_{column_name}_cell #}
{% block datagrid_column_type_action_cell %}
-{% apply spaceless %}
{% for action_name, action in cell.value %}
@@ -90,25 +81,20 @@
{% endfor %}
-{% endapply %}
{% endblock %}
{# pattern: datagrid_column_type_action_cell_action_{action_name} #}
{% block datagrid_column_type_action_cell_action_edit %}
-{% apply spaceless %}
-{% endapply %}
{% endblock %}
{# pattern: datagrid_column_type_action_cell_action_{action_name} #}
{% block datagrid_column_type_action_cell_action_display %}
- {% apply spaceless %}
-
-
-
- {% endapply %}
+
+
+
{% endblock %}
{%- block datagrid_header_class -%}
diff --git a/Resources/views/CRUD/datasource.html.twig b/Resources/views/CRUD/datasource.html.twig
index c8a088d4..a45ea080 100644
--- a/Resources/views/CRUD/datasource.html.twig
+++ b/Resources/views/CRUD/datasource.html.twig
@@ -1,16 +1,14 @@
{% extends 'bootstrap_3_layout.html.twig' %}
{% block datasource_field %}
- {% apply spaceless %}
- {% if field.hasAttribute('form') is not empty %}
- {% for child in field.getAttribute('form').children %}
- {% for grandchild in child %}
- {% form_theme grandchild _self %}
- {{ form_row(grandchild) }}
- {% endfor %}
+ {% if field.hasAttribute('form') is not empty %}
+ {% for child in field.getAttribute('form').children %}
+ {% for grandchild in child %}
+ {% form_theme grandchild _self %}
+ {{ form_row(grandchild) }}
{% endfor %}
- {% endif %}
- {% endapply %}
+ {% endfor %}
+ {% endif %}
{% endblock %}
{% block datasource_max_results %}
@@ -28,21 +26,16 @@
{% endblock %}
{% block datasource_between_row %}
- {% apply spaceless %}
- {{ form_widget(form) }}
- {% endapply %}
+ {{ form_widget(form) }}
{% endblock datasource_between_row %}
{% block datasource_between_widget %}
-{% apply spaceless %}
{% for child in form %}
{{ form_row(child) }}
{% endfor %}
-{% endapply %}
{% endblock datasource_between_widget %}
{% block datasource_pagination %}
-{% apply spaceless %}
-{% endapply %}
{% endblock %}
{% block datasource_sort %}
- {% apply spaceless %}
- {% if (field.getAttribute('sorted_ascending')) %}
-
-
-
- {% else %}
-
- {% endif %}
- {% if (field.getAttribute('sorted_descending')) %}
-
-
-
- {% else %}
-
- {% endif %}
- {% endapply %}
+ {% if (field.getAttribute('sorted_ascending')) %}
+
+
+
+ {% else %}
+
+ {% endif %}
+ {% if (field.getAttribute('sorted_descending')) %}
+
+
+
+ {% else %}
+
+ {% endif %}
{% endblock %}
diff --git a/Resources/views/Form/form_theme.html.twig b/Resources/views/Form/form_theme.html.twig
index 59f53b5d..29481528 100644
--- a/Resources/views/Form/form_theme.html.twig
+++ b/Resources/views/Form/form_theme.html.twig
@@ -20,10 +20,8 @@
{% endblock %}
{% block collection_prototype -%}
- {% apply spaceless %}
- {% set form = prototype %}
- {{ block('collection_item') }}
- {% endapply %}
+ {% set form = prototype %}
+ {{ block('collection_item') }}
{%- endblock %}
{% block collection_item %}
diff --git a/spec/FSi/Bundle/AdminBundle/Admin/CRUD/Context/FormElementContextSpec.php b/spec/FSi/Bundle/AdminBundle/Admin/CRUD/Context/FormElementContextSpec.php
index 9df630b8..842ceb78 100644
--- a/spec/FSi/Bundle/AdminBundle/Admin/CRUD/Context/FormElementContextSpec.php
+++ b/spec/FSi/Bundle/AdminBundle/Admin/CRUD/Context/FormElementContextSpec.php
@@ -19,6 +19,8 @@
use Prophecy\Argument;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormView;
+use Symfony\Component\HttpFoundation\InputBag;
+use Symfony\Component\HttpFoundation\ParameterBag;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
@@ -45,6 +47,7 @@ public function it_has_array_data(
FormView $formView,
Request $request
): void {
+ $request->attributes = new ParameterBag();
$form->createView()->willReturn($formView);
$form->getData()->willReturn(null);
@@ -68,6 +71,8 @@ public function it_returns_template_from_element_if_it_has_one(FormElement $elem
public function it_handles_request_with_request_handlers(HandlerInterface $handler, Request $request): void
{
+ $request->attributes = new ParameterBag();
+
$handler->handleRequest(Argument::type(FormEvent::class), $request)
->willReturn(null);
@@ -76,6 +81,8 @@ public function it_handles_request_with_request_handlers(HandlerInterface $handl
public function it_returns_response_from_handler(HandlerInterface $handler, Request $request): void
{
+ $request->attributes = new ParameterBag();
+
$handler->handleRequest(Argument::type(FormEvent::class), $request)
->willReturn(new Response());
@@ -85,7 +92,7 @@ public function it_returns_response_from_handler(HandlerInterface $handler, Requ
public function it_throws_exception_when_adding_is_not_allowed(Request $request, FormElement $element): void
{
- $request->get('id')->willReturn(null);
+ $request->attributes = new ParameterBag(['id' => null]);
$element->getOption('allow_add')->willReturn(false);
$this->shouldThrow(NotFoundHttpException::class)->during('handleRequest', [$request]);
}
diff --git a/spec/FSi/Bundle/AdminBundle/Admin/CRUD/DependentBatchElementSpec.php b/spec/FSi/Bundle/AdminBundle/Admin/CRUD/DependentBatchElementSpec.php
index cc8db738..328e477c 100644
--- a/spec/FSi/Bundle/AdminBundle/Admin/CRUD/DependentBatchElementSpec.php
+++ b/spec/FSi/Bundle/AdminBundle/Admin/CRUD/DependentBatchElementSpec.php
@@ -17,12 +17,16 @@
use FSi\Component\DataIndexer\DataIndexerInterface;
use FSi\Component\Translatable\LocaleProvider;
use PhpSpec\ObjectBehavior;
+use Symfony\Component\HttpFoundation\InputBag;
+use Symfony\Component\HttpFoundation\ParameterBag;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
use FSi\Bundle\AdminBundle\spec\fixtures\MyDependentBatch;
use FSi\Bundle\AdminBundle\Admin\CRUD\GenericBatchElement;
use FSi\Bundle\AdminBundle\Admin\CRUD\BatchElement;
+use function class_exists;
+
class DependentBatchElementSpec extends ObjectBehavior
{
public function let(LocaleProvider $localeProvider): void
@@ -53,7 +57,13 @@ public function it_returns_null_if_parent_object_id_is_not_available(
): void {
$parentElement->getDataIndexer()->willReturn($parentDataIndexer);
$requestStack->getCurrentRequest()->willReturn($currentRequest);
- $currentRequest->get(DependentElement::PARENT_REQUEST_PARAMETER)->willReturn(null);
+ if (class_exists(InputBag::class)) {
+ $requestQueryBag = new InputBag();
+ } else {
+ $requestQueryBag = new ParameterBag();
+ }
+ $requestQueryBag->set(DependentElement::PARENT_REQUEST_PARAMETER, null);
+ $currentRequest->query = $requestQueryBag;
$this->setRequestStack($requestStack);
$this->setParentElement($parentElement);
@@ -69,7 +79,13 @@ public function it_returns_parent_object_if_its_available(
): void {
$parentElement->getDataIndexer()->willReturn($parentDataIndexer);
$requestStack->getCurrentRequest()->willReturn($currentRequest);
- $currentRequest->get(DependentElement::PARENT_REQUEST_PARAMETER)->willReturn('parent_object_id');
+ if (class_exists(InputBag::class)) {
+ $requestQueryBag = new InputBag();
+ } else {
+ $requestQueryBag = new ParameterBag();
+ }
+ $requestQueryBag->set(DependentElement::PARENT_REQUEST_PARAMETER, 'parent_object_id');
+ $currentRequest->query = $requestQueryBag;
$parentDataIndexer->getData('parent_object_id')->willReturn('parent_object');
$this->setRequestStack($requestStack);
@@ -86,7 +102,13 @@ public function its_route_parameters_contain_parent_object_id_if_its_available(
): void {
$parentElement->getDataIndexer()->willReturn($parentDataIndexer);
$requestStack->getCurrentRequest()->willReturn($currentRequest);
- $currentRequest->get(DependentElement::PARENT_REQUEST_PARAMETER)->willReturn('parent_object_id');
+ if (class_exists(InputBag::class)) {
+ $requestQueryBag = new InputBag();
+ } else {
+ $requestQueryBag = new ParameterBag();
+ }
+ $requestQueryBag->set(DependentElement::PARENT_REQUEST_PARAMETER, 'parent_object_id');
+ $currentRequest->query = $requestQueryBag;
$this->setRequestStack($requestStack);
$this->setParentElement($parentElement);
diff --git a/spec/FSi/Bundle/AdminBundle/Admin/CRUD/DependentCRUDElementSpec.php b/spec/FSi/Bundle/AdminBundle/Admin/CRUD/DependentCRUDElementSpec.php
index 9cfa4380..1202edcc 100644
--- a/spec/FSi/Bundle/AdminBundle/Admin/CRUD/DependentCRUDElementSpec.php
+++ b/spec/FSi/Bundle/AdminBundle/Admin/CRUD/DependentCRUDElementSpec.php
@@ -23,6 +23,8 @@
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use Symfony\Component\Form\FormFactoryInterface;
+use Symfony\Component\HttpFoundation\InputBag;
+use Symfony\Component\HttpFoundation\ParameterBag;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
use FSi\Bundle\AdminBundle\spec\fixtures\MyDependentCRUD;
@@ -59,7 +61,13 @@ public function it_returns_null_if_parent_object_id_is_not_available(
): void {
$parentElement->getDataIndexer()->willReturn($parentDataIndexer);
$requestStack->getCurrentRequest()->willReturn($currentRequest);
- $currentRequest->get(DependentElement::PARENT_REQUEST_PARAMETER)->willReturn(null);
+ if (class_exists(InputBag::class)) {
+ $requestQueryBag = new InputBag();
+ } else {
+ $requestQueryBag = new ParameterBag();
+ }
+ $requestQueryBag->set(DependentElement::PARENT_REQUEST_PARAMETER, null);
+ $currentRequest->query = $requestQueryBag;
$this->setRequestStack($requestStack);
$this->setParentElement($parentElement);
@@ -75,7 +83,13 @@ public function it_returns_parent_object_if_its_available(
): void {
$parentElement->getDataIndexer()->willReturn($parentDataIndexer);
$requestStack->getCurrentRequest()->willReturn($currentRequest);
- $currentRequest->get(DependentElement::PARENT_REQUEST_PARAMETER)->willReturn('parent_object_id');
+ if (class_exists(InputBag::class)) {
+ $requestQueryBag = new InputBag();
+ } else {
+ $requestQueryBag = new ParameterBag();
+ }
+ $requestQueryBag->set(DependentElement::PARENT_REQUEST_PARAMETER, 'parent_object_id');
+ $currentRequest->query = $requestQueryBag;
$parentDataIndexer->getData('parent_object_id')->willReturn('parent_object');
$this->setRequestStack($requestStack);
@@ -92,7 +106,13 @@ public function its_route_parameters_contain_parent_object_id_if_its_available(
): void {
$parentElement->getDataIndexer()->willReturn($parentDataIndexer);
$requestStack->getCurrentRequest()->willReturn($currentRequest);
- $currentRequest->get(DependentElement::PARENT_REQUEST_PARAMETER)->willReturn('parent_object_id');
+ if (class_exists(InputBag::class)) {
+ $requestQueryBag = new InputBag();
+ } else {
+ $requestQueryBag = new ParameterBag();
+ }
+ $requestQueryBag->set(DependentElement::PARENT_REQUEST_PARAMETER, 'parent_object_id');
+ $currentRequest->query = $requestQueryBag;
$this->setRequestStack($requestStack);
$this->setParentElement($parentElement);
diff --git a/spec/FSi/Bundle/AdminBundle/Admin/CRUD/DependentFormElementSpec.php b/spec/FSi/Bundle/AdminBundle/Admin/CRUD/DependentFormElementSpec.php
index 49457fa6..18371c63 100644
--- a/spec/FSi/Bundle/AdminBundle/Admin/CRUD/DependentFormElementSpec.php
+++ b/spec/FSi/Bundle/AdminBundle/Admin/CRUD/DependentFormElementSpec.php
@@ -20,6 +20,8 @@
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use Symfony\Component\Form\FormFactoryInterface;
+use Symfony\Component\HttpFoundation\InputBag;
+use Symfony\Component\HttpFoundation\ParameterBag;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
use FSi\Bundle\AdminBundle\spec\fixtures\MyDependentForm;
@@ -57,7 +59,13 @@ public function it_returns_null_if_parent_object_id_is_not_available(
): void {
$parentElement->getDataIndexer()->willReturn($parentDataIndexer);
$requestStack->getCurrentRequest()->willReturn($currentRequest);
- $currentRequest->get(DependentElement::PARENT_REQUEST_PARAMETER)->willReturn(null);
+ if (class_exists(InputBag::class)) {
+ $requestQueryBag = new InputBag();
+ } else {
+ $requestQueryBag = new ParameterBag();
+ }
+ $requestQueryBag->set(DependentElement::PARENT_REQUEST_PARAMETER, null);
+ $currentRequest->query = $requestQueryBag;
$this->setRequestStack($requestStack);
$this->setParentElement($parentElement);
@@ -73,7 +81,13 @@ public function it_returns_parent_object_if_its_available(
): void {
$parentElement->getDataIndexer()->willReturn($parentDataIndexer);
$requestStack->getCurrentRequest()->willReturn($currentRequest);
- $currentRequest->get(DependentElement::PARENT_REQUEST_PARAMETER)->willReturn('parent_object_id');
+ if (class_exists(InputBag::class)) {
+ $requestQueryBag = new InputBag();
+ } else {
+ $requestQueryBag = new ParameterBag();
+ }
+ $requestQueryBag->set(DependentElement::PARENT_REQUEST_PARAMETER, 'parent_object_id');
+ $currentRequest->query = $requestQueryBag;
$parentDataIndexer->getData('parent_object_id')->willReturn('parent_object');
$this->setRequestStack($requestStack);
@@ -90,7 +104,13 @@ public function its_route_parameters_contain_parent_object_id_if_its_available(
): void {
$parentElement->getDataIndexer()->willReturn($parentDataIndexer);
$requestStack->getCurrentRequest()->willReturn($currentRequest);
- $currentRequest->get(DependentElement::PARENT_REQUEST_PARAMETER)->willReturn('parent_object_id');
+ if (class_exists(InputBag::class)) {
+ $requestQueryBag = new InputBag();
+ } else {
+ $requestQueryBag = new ParameterBag();
+ }
+ $requestQueryBag->set(DependentElement::PARENT_REQUEST_PARAMETER, 'parent_object_id');
+ $currentRequest->query = $requestQueryBag;
$this->setRequestStack($requestStack);
$this->setParentElement($parentElement);
diff --git a/spec/FSi/Bundle/AdminBundle/Admin/CRUD/DependentListElementSpec.php b/spec/FSi/Bundle/AdminBundle/Admin/CRUD/DependentListElementSpec.php
index 3e6d5017..e441710c 100644
--- a/spec/FSi/Bundle/AdminBundle/Admin/CRUD/DependentListElementSpec.php
+++ b/spec/FSi/Bundle/AdminBundle/Admin/CRUD/DependentListElementSpec.php
@@ -21,6 +21,8 @@
use FSi\Component\Translatable\LocaleProvider;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
+use Symfony\Component\HttpFoundation\InputBag;
+use Symfony\Component\HttpFoundation\ParameterBag;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
use FSi\Bundle\AdminBundle\spec\fixtures\MyDependentList;
@@ -57,7 +59,13 @@ public function it_returns_null_if_parent_object_id_is_not_available(
): void {
$parentElement->getDataIndexer()->willReturn($parentDataIndexer);
$requestStack->getCurrentRequest()->willReturn($currentRequest);
- $currentRequest->get(DependentElement::PARENT_REQUEST_PARAMETER)->willReturn(null);
+ if (class_exists(InputBag::class)) {
+ $requestQueryBag = new InputBag();
+ } else {
+ $requestQueryBag = new ParameterBag();
+ }
+ $requestQueryBag->set(DependentElement::PARENT_REQUEST_PARAMETER, null);
+ $currentRequest->query = $requestQueryBag;
$this->setRequestStack($requestStack);
$this->setParentElement($parentElement);
@@ -73,7 +81,13 @@ public function it_returns_parent_object_if_its_available(
): void {
$parentElement->getDataIndexer()->willReturn($parentDataIndexer);
$requestStack->getCurrentRequest()->willReturn($currentRequest);
- $currentRequest->get(DependentElement::PARENT_REQUEST_PARAMETER)->willReturn('parent_object_id');
+ if (class_exists(InputBag::class)) {
+ $requestQueryBag = new InputBag();
+ } else {
+ $requestQueryBag = new ParameterBag();
+ }
+ $requestQueryBag->set(DependentElement::PARENT_REQUEST_PARAMETER, 'parent_object_id');
+ $currentRequest->query = $requestQueryBag;
$parentDataIndexer->getData('parent_object_id')->willReturn('parent_object');
$this->setRequestStack($requestStack);
@@ -90,7 +104,13 @@ public function its_route_parameters_contain_parent_object_id_if_its_available(
): void {
$parentElement->getDataIndexer()->willReturn($parentDataIndexer);
$requestStack->getCurrentRequest()->willReturn($currentRequest);
- $currentRequest->get(DependentElement::PARENT_REQUEST_PARAMETER)->willReturn('parent_object_id');
+ if (class_exists(InputBag::class)) {
+ $requestQueryBag = new InputBag();
+ } else {
+ $requestQueryBag = new ParameterBag();
+ }
+ $requestQueryBag->set(DependentElement::PARENT_REQUEST_PARAMETER, 'parent_object_id');
+ $currentRequest->query = $requestQueryBag;
$this->setRequestStack($requestStack);
$this->setParentElement($parentElement);
diff --git a/spec/FSi/Bundle/AdminBundle/Admin/Display/Context/DisplayContextSpec.php b/spec/FSi/Bundle/AdminBundle/Admin/Display/Context/DisplayContextSpec.php
index 9b02ce92..ac00cc5d 100644
--- a/spec/FSi/Bundle/AdminBundle/Admin/Display/Context/DisplayContextSpec.php
+++ b/spec/FSi/Bundle/AdminBundle/Admin/Display/Context/DisplayContextSpec.php
@@ -18,6 +18,7 @@
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use stdClass;
+use Symfony\Component\HttpFoundation\ParameterBag;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Request;
use FSi\Bundle\AdminBundle\Admin\Context\ContextInterface;
@@ -33,7 +34,7 @@ public function let(
Display $display,
Request $request
): void {
- $request->get('id', null)->willReturn('index');
+ $request->attributes = new ParameterBag(['id' => 'index']);
$element->getDataIndexer()->willReturn($dataIndexer);
$dataIndexer->getData('index')->willReturn($displayObject);
$element->createDisplay($displayObject)->willReturn($display);
diff --git a/spec/FSi/Bundle/AdminBundle/Doctrine/Admin/DependentBatchElementSpec.php b/spec/FSi/Bundle/AdminBundle/Doctrine/Admin/DependentBatchElementSpec.php
index 34be5727..27e718a2 100644
--- a/spec/FSi/Bundle/AdminBundle/Doctrine/Admin/DependentBatchElementSpec.php
+++ b/spec/FSi/Bundle/AdminBundle/Doctrine/Admin/DependentBatchElementSpec.php
@@ -21,6 +21,8 @@
use FSi\Component\DataIndexer\DataIndexerInterface;
use FSi\Component\Translatable\LocaleProvider;
use PhpSpec\ObjectBehavior;
+use Symfony\Component\HttpFoundation\InputBag;
+use Symfony\Component\HttpFoundation\ParameterBag;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
use FSi\Bundle\AdminBundle\spec\fixtures\Doctrine\MyDependentBatchElement;
@@ -55,7 +57,13 @@ public function it_returns_null_if_parent_object_id_is_not_available(
): void {
$parentElement->getDataIndexer()->willReturn($parentDataIndexer);
$requestStack->getCurrentRequest()->willReturn($currentRequest);
- $currentRequest->get(DependentElement::PARENT_REQUEST_PARAMETER)->willReturn(null);
+ if (class_exists(InputBag::class)) {
+ $requestQueryBag = new InputBag();
+ } else {
+ $requestQueryBag = new ParameterBag();
+ }
+ $requestQueryBag->set(DependentElement::PARENT_REQUEST_PARAMETER, null);
+ $currentRequest->query = $requestQueryBag;
$this->setRequestStack($requestStack);
$this->setParentElement($parentElement);
@@ -71,7 +79,13 @@ public function it_returns_parent_object_if_its_available(
): void {
$parentElement->getDataIndexer()->willReturn($parentDataIndexer);
$requestStack->getCurrentRequest()->willReturn($currentRequest);
- $currentRequest->get(DependentElement::PARENT_REQUEST_PARAMETER)->willReturn('parent_object_id');
+ if (class_exists(InputBag::class)) {
+ $requestQueryBag = new InputBag();
+ } else {
+ $requestQueryBag = new ParameterBag();
+ }
+ $requestQueryBag->set(DependentElement::PARENT_REQUEST_PARAMETER, 'parent_object_id');
+ $currentRequest->query = $requestQueryBag;
$parentDataIndexer->getData('parent_object_id')->willReturn('parent_object');
$this->setRequestStack($requestStack);
@@ -88,7 +102,13 @@ public function its_route_parameters_contain_parent_object_id_if_its_available(
): void {
$parentElement->getDataIndexer()->willReturn($parentDataIndexer);
$requestStack->getCurrentRequest()->willReturn($currentRequest);
- $currentRequest->get(DependentElement::PARENT_REQUEST_PARAMETER)->willReturn('parent_object_id');
+ if (class_exists(InputBag::class)) {
+ $requestQueryBag = new InputBag();
+ } else {
+ $requestQueryBag = new ParameterBag();
+ }
+ $requestQueryBag->set(DependentElement::PARENT_REQUEST_PARAMETER, 'parent_object_id');
+ $currentRequest->query = $requestQueryBag;
$this->setRequestStack($requestStack);
$this->setParentElement($parentElement);
diff --git a/spec/FSi/Bundle/AdminBundle/Doctrine/Admin/DependentCRUDElementSpec.php b/spec/FSi/Bundle/AdminBundle/Doctrine/Admin/DependentCRUDElementSpec.php
index a82d7b56..8287df2b 100644
--- a/spec/FSi/Bundle/AdminBundle/Doctrine/Admin/DependentCRUDElementSpec.php
+++ b/spec/FSi/Bundle/AdminBundle/Doctrine/Admin/DependentCRUDElementSpec.php
@@ -22,6 +22,8 @@
use FSi\Component\Translatable\LocaleProvider;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
+use Symfony\Component\HttpFoundation\InputBag;
+use Symfony\Component\HttpFoundation\ParameterBag;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
use FSi\Bundle\AdminBundle\spec\fixtures\Doctrine\MyDependentCrudElement;
@@ -56,7 +58,13 @@ public function it_returns_null_if_parent_object_id_is_not_available(
): void {
$parentElement->getDataIndexer()->willReturn($parentDataIndexer);
$requestStack->getCurrentRequest()->willReturn($currentRequest);
- $currentRequest->get(DependentElement::PARENT_REQUEST_PARAMETER)->willReturn(null);
+ if (class_exists(InputBag::class)) {
+ $requestQueryBag = new InputBag();
+ } else {
+ $requestQueryBag = new ParameterBag();
+ }
+ $requestQueryBag->set(DependentElement::PARENT_REQUEST_PARAMETER, null);
+ $currentRequest->query = $requestQueryBag;
$this->setRequestStack($requestStack);
$this->setParentElement($parentElement);
@@ -72,7 +80,13 @@ public function it_returns_parent_object_if_its_available(
): void {
$parentElement->getDataIndexer()->willReturn($parentDataIndexer);
$requestStack->getCurrentRequest()->willReturn($currentRequest);
- $currentRequest->get(DependentElement::PARENT_REQUEST_PARAMETER)->willReturn('parent_object_id');
+ if (class_exists(InputBag::class)) {
+ $requestQueryBag = new InputBag();
+ } else {
+ $requestQueryBag = new ParameterBag();
+ }
+ $requestQueryBag->set(DependentElement::PARENT_REQUEST_PARAMETER, 'parent_object_id');
+ $currentRequest->query = $requestQueryBag;
$parentDataIndexer->getData('parent_object_id')->willReturn('parent_object');
$this->setRequestStack($requestStack);
@@ -89,7 +103,13 @@ public function its_route_parameters_contain_parent_object_id_if_its_available(
): void {
$parentElement->getDataIndexer()->willReturn($parentDataIndexer);
$requestStack->getCurrentRequest()->willReturn($currentRequest);
- $currentRequest->get(DependentElement::PARENT_REQUEST_PARAMETER)->willReturn('parent_object_id');
+ if (class_exists(InputBag::class)) {
+ $requestQueryBag = new InputBag();
+ } else {
+ $requestQueryBag = new ParameterBag();
+ }
+ $requestQueryBag->set(DependentElement::PARENT_REQUEST_PARAMETER, 'parent_object_id');
+ $currentRequest->query = $requestQueryBag;
$this->setRequestStack($requestStack);
$this->setParentElement($parentElement);
diff --git a/spec/FSi/Bundle/AdminBundle/Doctrine/Admin/DependentDeleteElementSpec.php b/spec/FSi/Bundle/AdminBundle/Doctrine/Admin/DependentDeleteElementSpec.php
index 59a86a49..a93dac4e 100644
--- a/spec/FSi/Bundle/AdminBundle/Doctrine/Admin/DependentDeleteElementSpec.php
+++ b/spec/FSi/Bundle/AdminBundle/Doctrine/Admin/DependentDeleteElementSpec.php
@@ -21,6 +21,8 @@
use FSi\Component\DataIndexer\DataIndexerInterface;
use FSi\Component\Translatable\LocaleProvider;
use PhpSpec\ObjectBehavior;
+use Symfony\Component\HttpFoundation\InputBag;
+use Symfony\Component\HttpFoundation\ParameterBag;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
use FSi\Bundle\AdminBundle\spec\fixtures\Doctrine\MyDependentDeleteElement;
@@ -54,7 +56,13 @@ public function it_returns_null_if_parent_object_id_is_not_available(
): void {
$parentElement->getDataIndexer()->willReturn($parentDataIndexer);
$requestStack->getCurrentRequest()->willReturn($currentRequest);
- $currentRequest->get(DependentElement::PARENT_REQUEST_PARAMETER)->willReturn(null);
+ if (class_exists(InputBag::class)) {
+ $requestQueryBag = new InputBag();
+ } else {
+ $requestQueryBag = new ParameterBag();
+ }
+ $requestQueryBag->set(DependentElement::PARENT_REQUEST_PARAMETER, null);
+ $currentRequest->query = $requestQueryBag;
$this->setRequestStack($requestStack);
$this->setParentElement($parentElement);
@@ -70,7 +78,13 @@ public function it_returns_parent_object_if_its_available(
): void {
$parentElement->getDataIndexer()->willReturn($parentDataIndexer);
$requestStack->getCurrentRequest()->willReturn($currentRequest);
- $currentRequest->get(DependentElement::PARENT_REQUEST_PARAMETER)->willReturn('parent_object_id');
+ if (class_exists(InputBag::class)) {
+ $requestQueryBag = new InputBag();
+ } else {
+ $requestQueryBag = new ParameterBag();
+ }
+ $requestQueryBag->set(DependentElement::PARENT_REQUEST_PARAMETER, 'parent_object_id');
+ $currentRequest->query = $requestQueryBag;
$parentDataIndexer->getData('parent_object_id')->willReturn('parent_object');
$this->setRequestStack($requestStack);
@@ -87,7 +101,13 @@ public function its_route_parameters_contain_parent_object_id_if_its_available(
): void {
$parentElement->getDataIndexer()->willReturn($parentDataIndexer);
$requestStack->getCurrentRequest()->willReturn($currentRequest);
- $currentRequest->get(DependentElement::PARENT_REQUEST_PARAMETER)->willReturn('parent_object_id');
+ if (class_exists(InputBag::class)) {
+ $requestQueryBag = new InputBag();
+ } else {
+ $requestQueryBag = new ParameterBag();
+ }
+ $requestQueryBag->set(DependentElement::PARENT_REQUEST_PARAMETER, 'parent_object_id');
+ $currentRequest->query = $requestQueryBag;
$this->setRequestStack($requestStack);
$this->setParentElement($parentElement);
diff --git a/spec/FSi/Bundle/AdminBundle/Doctrine/Admin/DependentFormElementSpec.php b/spec/FSi/Bundle/AdminBundle/Doctrine/Admin/DependentFormElementSpec.php
index 15d78014..d6f70766 100644
--- a/spec/FSi/Bundle/AdminBundle/Doctrine/Admin/DependentFormElementSpec.php
+++ b/spec/FSi/Bundle/AdminBundle/Doctrine/Admin/DependentFormElementSpec.php
@@ -21,6 +21,8 @@
use FSi\Component\DataIndexer\DataIndexerInterface;
use FSi\Component\Translatable\LocaleProvider;
use PhpSpec\ObjectBehavior;
+use Symfony\Component\HttpFoundation\InputBag;
+use Symfony\Component\HttpFoundation\ParameterBag;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
use FSi\Bundle\AdminBundle\spec\fixtures\Doctrine\MyDependentFormElement;
@@ -55,7 +57,13 @@ public function it_returns_null_if_parent_object_id_is_not_available(
): void {
$parentElement->getDataIndexer()->willReturn($parentDataIndexer);
$requestStack->getCurrentRequest()->willReturn($currentRequest);
- $currentRequest->get(DependentElement::PARENT_REQUEST_PARAMETER)->willReturn(null);
+ if (class_exists(InputBag::class)) {
+ $requestQueryBag = new InputBag();
+ } else {
+ $requestQueryBag = new ParameterBag();
+ }
+ $requestQueryBag->set(DependentElement::PARENT_REQUEST_PARAMETER, null);
+ $currentRequest->query = $requestQueryBag;
$this->setRequestStack($requestStack);
$this->setParentElement($parentElement);
@@ -71,7 +79,13 @@ public function it_returns_parent_object_if_its_available(
): void {
$parentElement->getDataIndexer()->willReturn($parentDataIndexer);
$requestStack->getCurrentRequest()->willReturn($currentRequest);
- $currentRequest->get(DependentElement::PARENT_REQUEST_PARAMETER)->willReturn('parent_object_id');
+ if (class_exists(InputBag::class)) {
+ $requestQueryBag = new InputBag();
+ } else {
+ $requestQueryBag = new ParameterBag();
+ }
+ $requestQueryBag->set(DependentElement::PARENT_REQUEST_PARAMETER, 'parent_object_id');
+ $currentRequest->query = $requestQueryBag;
$parentDataIndexer->getData('parent_object_id')->willReturn('parent_object');
$this->setRequestStack($requestStack);
@@ -88,7 +102,13 @@ public function its_route_parameters_contain_parent_object_id_if_its_available(
): void {
$parentElement->getDataIndexer()->willReturn($parentDataIndexer);
$requestStack->getCurrentRequest()->willReturn($currentRequest);
- $currentRequest->get(DependentElement::PARENT_REQUEST_PARAMETER)->willReturn('parent_object_id');
+ if (class_exists(InputBag::class)) {
+ $requestQueryBag = new InputBag();
+ } else {
+ $requestQueryBag = new ParameterBag();
+ }
+ $requestQueryBag->set(DependentElement::PARENT_REQUEST_PARAMETER, 'parent_object_id');
+ $currentRequest->query = $requestQueryBag;
$this->setRequestStack($requestStack);
$this->setParentElement($parentElement);
diff --git a/spec/FSi/Bundle/AdminBundle/Doctrine/Admin/DependentListElementSpec.php b/spec/FSi/Bundle/AdminBundle/Doctrine/Admin/DependentListElementSpec.php
index 73a4ddfb..bb4165bf 100644
--- a/spec/FSi/Bundle/AdminBundle/Doctrine/Admin/DependentListElementSpec.php
+++ b/spec/FSi/Bundle/AdminBundle/Doctrine/Admin/DependentListElementSpec.php
@@ -21,6 +21,8 @@
use FSi\Component\DataIndexer\DataIndexerInterface;
use FSi\Component\Translatable\LocaleProvider;
use PhpSpec\ObjectBehavior;
+use Symfony\Component\HttpFoundation\InputBag;
+use Symfony\Component\HttpFoundation\ParameterBag;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
use FSi\Bundle\AdminBundle\spec\fixtures\Doctrine\MyDependentListElement;
@@ -55,7 +57,13 @@ public function it_returns_null_if_parent_object_id_is_not_available(
): void {
$parentElement->getDataIndexer()->willReturn($parentDataIndexer);
$requestStack->getCurrentRequest()->willReturn($currentRequest);
- $currentRequest->get(DependentElement::PARENT_REQUEST_PARAMETER)->willReturn(null);
+ if (class_exists(InputBag::class)) {
+ $requestQueryBag = new InputBag();
+ } else {
+ $requestQueryBag = new ParameterBag();
+ }
+ $requestQueryBag->set(DependentElement::PARENT_REQUEST_PARAMETER, null);
+ $currentRequest->query = $requestQueryBag;
$this->setRequestStack($requestStack);
$this->setParentElement($parentElement);
@@ -71,7 +79,13 @@ public function it_returns_parent_object_if_its_available(
): void {
$parentElement->getDataIndexer()->willReturn($parentDataIndexer);
$requestStack->getCurrentRequest()->willReturn($currentRequest);
- $currentRequest->get(DependentElement::PARENT_REQUEST_PARAMETER)->willReturn('parent_object_id');
+ if (class_exists(InputBag::class)) {
+ $requestQueryBag = new InputBag();
+ } else {
+ $requestQueryBag = new ParameterBag();
+ }
+ $requestQueryBag->set(DependentElement::PARENT_REQUEST_PARAMETER, 'parent_object_id');
+ $currentRequest->query = $requestQueryBag;
$parentDataIndexer->getData('parent_object_id')->willReturn('parent_object');
$this->setRequestStack($requestStack);
@@ -88,7 +102,13 @@ public function its_route_parameters_contain_parent_object_id_if_its_available(
): void {
$parentElement->getDataIndexer()->willReturn($parentDataIndexer);
$requestStack->getCurrentRequest()->willReturn($currentRequest);
- $currentRequest->get(DependentElement::PARENT_REQUEST_PARAMETER)->willReturn('parent_object_id');
+ if (class_exists(InputBag::class)) {
+ $requestQueryBag = new InputBag();
+ } else {
+ $requestQueryBag = new ParameterBag();
+ }
+ $requestQueryBag->set(DependentElement::PARENT_REQUEST_PARAMETER, 'parent_object_id');
+ $currentRequest->query = $requestQueryBag;
$this->setRequestStack($requestStack);
$this->setParentElement($parentElement);