Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix - move RedirectPathExtension from Admin bundle to Ui bundle #14433

Merged
merged 6 commits into from
Oct 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@

namespace Sylius\Bundle\AdminBundle\Controller;

use Sylius\Bundle\AdminBundle\Storage\FilterStorageInterface;
use Sylius\Bundle\ResourceBundle\Controller\RedirectHandlerInterface;
use Sylius\Bundle\ResourceBundle\Controller\RequestConfiguration;
use Sylius\Bundle\UiBundle\Storage\FilterStorageInterface;
use Sylius\Component\Resource\Model\ResourceInterface;
use Symfony\Component\HttpFoundation\Response;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

namespace Sylius\Bundle\AdminBundle\EventListener;

use Sylius\Bundle\AdminBundle\Storage\FilterStorageInterface;
use Sylius\Bundle\UiBundle\Storage\FilterStorageInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\Event\RequestEvent;
use Symfony\Component\HttpKernel\KernelEvents;
Expand Down
10 changes: 0 additions & 10 deletions src/Sylius/Bundle/AdminBundle/Resources/config/services.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,6 @@
<tag name="twig.extension" />
</service>

<service id="Sylius\Bundle\AdminBundle\Twig\RedirectPathExtension">
<argument type="service" id="Sylius\Bundle\AdminBundle\Storage\FilterStorage" />
<argument type="service" id="router" />
<tag name="twig.extension" />
</service>

<service id="Sylius\Bundle\AdminBundle\Storage\FilterStorage" public="false">
<argument type="service" id="request_stack" />
</service>

<service id="sylius.http_client" class="GuzzleHttp\Client" public="false" />
<service id="sylius.http_message_factory" class="Http\Message\MessageFactory\GuzzleMessageFactory" public="false" />
</services>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
public="false"
>
<argument type="service" id="Sylius\Bundle\AdminBundle\Controller\RedirectHandler.inner" />
<argument type="service" id="Sylius\Bundle\AdminBundle\Storage\FilterStorage" />
<argument type="service" id="Sylius\Bundle\UiBundle\Storage\FilterStorage" />
</service>
</services>
</container>
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
</service>

<service id="sylius.event_subscriber.admin_filter_subscriber" class="Sylius\Bundle\AdminBundle\EventListener\AdminFilterSubscriber">
<argument type="service" id="Sylius\Bundle\AdminBundle\Storage\FilterStorage" />
<argument type="service" id="Sylius\Bundle\UiBundle\Storage\FilterStorage" />
<tag name="kernel.event_subscriber" event="kernel.request" />
</service>
</services>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
namespace spec\Sylius\Bundle\AdminBundle\Controller;

use PhpSpec\ObjectBehavior;
use Sylius\Bundle\AdminBundle\Storage\FilterStorageInterface;
use Sylius\Bundle\ResourceBundle\Controller\RedirectHandlerInterface;
use Sylius\Bundle\ResourceBundle\Controller\RequestConfiguration;
use Sylius\Bundle\UiBundle\Storage\FilterStorageInterface;
use Sylius\Component\Resource\Model\ResourceInterface;
use Symfony\Component\HttpFoundation\Response;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use Sylius\Bundle\AdminBundle\Storage\FilterStorageInterface;
use Sylius\Bundle\UiBundle\Storage\FilterStorageInterface;
use Symfony\Component\HttpFoundation\ParameterBag;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Event\RequestEvent;
Expand Down
10 changes: 10 additions & 0 deletions src/Sylius/Bundle/UiBundle/Resources/config/services/twig.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,15 @@
<argument>%sylius_ui.sonata_block.whitelisted_variables%</argument>
<tag name="twig.extension" />
</service>

<service id="Sylius\Bundle\UiBundle\Twig\RedirectPathExtension">
<argument type="service" id="Sylius\Bundle\UiBundle\Storage\FilterStorage" />
<argument type="service" id="router" />
<tag name="twig.extension" />
</service>

<service id="Sylius\Bundle\UiBundle\Storage\FilterStorage" public="false">
<argument type="service" id="request_stack" />
</service>
</services>
</container>
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

declare(strict_types=1);

namespace Sylius\Bundle\AdminBundle\Storage;
namespace Sylius\Bundle\UiBundle\Storage;

use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

declare(strict_types=1);

namespace Sylius\Bundle\AdminBundle\Storage;
namespace Sylius\Bundle\UiBundle\Storage;

interface FilterStorageInterface
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@

declare(strict_types=1);

namespace Sylius\Bundle\AdminBundle\Twig;
namespace Sylius\Bundle\UiBundle\Twig;

use Sylius\Bundle\AdminBundle\Storage\FilterStorageInterface;
use Sylius\Bundle\UiBundle\Storage\FilterStorageInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\RouterInterface;
use Twig\Extension\AbstractExtension;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@

declare(strict_types=1);

namespace spec\Sylius\Bundle\AdminBundle\Storage;
namespace spec\Sylius\Bundle\UiBundle\Storage;

use PhpSpec\ObjectBehavior;
use Sylius\Bundle\AdminBundle\Storage\FilterStorageInterface;
use Sylius\Bundle\UiBundle\Storage\FilterStorageInterface;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\HttpFoundation\Session\SessionInterface;

Expand Down
6 changes: 3 additions & 3 deletions tests/Twig/RedirectPathExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Sylius\Tests\Twig;

use Sylius\Bundle\AdminBundle\Twig\RedirectPathExtension;
use Sylius\Bundle\UiBundle\Twig\RedirectPathExtension;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Symfony\Component\HttpFoundation\Request;

Expand All @@ -21,8 +21,8 @@ protected function setUp(): void
$request->setSession($session);
$container->get('request_stack')->push($request);

$this->redirectPathExtension = $container->get('Sylius\Bundle\AdminBundle\Twig\RedirectPathExtension');
$container->get('Sylius\Bundle\AdminBundle\Storage\FilterStorage')->set(['criteria' => ['enabled' => true]]);
$this->redirectPathExtension = $container->get('Sylius\Bundle\UiBundle\Twig\RedirectPathExtension');
$container->get('Sylius\Bundle\UiBundle\Storage\FilterStorage')->set(['criteria' => ['enabled' => true]]);
}

/** @test */
Expand Down