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

[AllBundles] Sf 3.4 and elastica 6 bc layer cleanup #3005

Merged
merged 1 commit into from
Oct 25, 2021
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
5 changes: 4 additions & 1 deletion src/Kunstmaan/AdminBundle/EventListener/ToolbarListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,10 @@ public function onKernelResponse(ResponseEvent $event)
$url = $event->getRequest()->getRequestUri();
$token = $this->tokenStorage->getToken();

if (null !== $token && method_exists($token, 'getProviderKey')) {
if (null !== $token && method_exists($token, 'getFirewallName')) {
$key = $token->getFirewallName();
} elseif (null !== $token && method_exists($token, 'getProviderKey')) {
// NEXT_MAJOR remove check when symfony 4.4 support is removed
$key = $token->getProviderKey();
} else {
$key = $this->adminFirewallName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,7 @@ public function testConfiguration()

$this->assertInstanceOf(TreeBuilder::class, $tree);

if (method_exists($tree, 'getRootNode')) {
$node = $tree->getRootNode();
} else {
// BC layer for symfony/config 4.1 and older
$node = $tree->root('kunstmaan_form');
}
$node = $tree->getRootNode();
$this->assertInstanceOf(ArrayNodeDefinition::class, $node);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,14 @@
use Kunstmaan\AdminBundle\Helper\AdminRouteHelper;
use Kunstmaan\AdminBundle\Helper\DomainConfigurationInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
use Symfony\Component\HttpKernel\Event\ResponseEvent;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\Translation\TranslatorInterface as LegacyTranslatorInterface;
use Symfony\Contracts\Translation\TranslatorInterface;

class HostOverrideListener
{
/**
* @var LegacyTranslatorInterface|TranslatorInterface
* @var TranslatorInterface
*/
protected $translator;

Expand All @@ -29,15 +27,8 @@ class HostOverrideListener
*/
protected $adminRouteHelper;

public function __construct(
/* TranslatorInterface */ $translator,
DomainConfigurationInterface $domainConfiguration,
AdminRouteHelper $adminRouteHelper
) {
if (!$translator instanceof LegacyTranslatorInterface && !$translator instanceof TranslatorInterface) {
throw new \InvalidArgumentException(sprintf('Argument "$translator" passed to "%s" must be of the type "%s" or "%s", "%s" given', __METHOD__, LegacyTranslatorInterface::class, TranslatorInterface::class, get_class($translator)));
}

public function __construct(TranslatorInterface $translator, DomainConfigurationInterface $domainConfiguration, AdminRouteHelper $adminRouteHelper)
{
$this->translator = $translator;
$this->domainConfiguration = $domainConfiguration;
$this->adminRouteHelper = $adminRouteHelper;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Session\Session;
use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage;
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
use Symfony\Component\HttpKernel\Event\RequestEvent;
use Symfony\Component\HttpKernel\Event\ResponseEvent;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\HttpKernel\KernelInterface;
Expand Down
2 changes: 1 addition & 1 deletion src/Kunstmaan/NodeBundle/Event/SlugSecurityEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

namespace Kunstmaan\NodeBundle\Event;

use Symfony\Contracts\EventDispatcher\Event;
use Kunstmaan\NodeBundle\Entity\HasNodeInterface;
use Kunstmaan\NodeBundle\Entity\Node;
use Kunstmaan\NodeBundle\Entity\NodeTranslation;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Contracts\EventDispatcher\Event;

final class SlugSecurityEvent extends Event
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,6 @@ public function getSearchResult()
$search = new Search($this->search->getClient());
$search->addIndex($index);

if (method_exists($search, 'getType')) {
$search->addType($index->getType($this->indexType));
}

return $search->search($this->query);
}

Expand Down
14 changes: 0 additions & 14 deletions src/Kunstmaan/SearchBundle/Provider/ElasticaProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,6 @@ public function getIndex($indexName)
*/
public function createDocument($uid, $document, $indexName = '', $indexType = '')
{
if (method_exists(Document::class, 'setType')) {
// @phpstan-ignore-next-line
return new Document($uid, $document, $indexType, $indexName);
}

return new Document($uid, $document, $indexName);
}

Expand All @@ -87,9 +82,6 @@ public function addDocument($indexName, $indexType, $document, $uid)
{
$doc = $this->createDocument($uid, $document);
$index = $this->getClient()->getIndex($indexName);
if (method_exists($index, 'getType')) {
return $index->getType($indexType)->addDocument($doc);
}

return $index->addDocument($doc);
}
Expand Down Expand Up @@ -131,12 +123,6 @@ public function deleteDocuments($indexName, $indexType, array $ids)
{
$index = $this->getIndex($indexName);

if (method_exists($index, 'getType')) {
$type = $index->getType($indexType);

return $this->getClient()->deleteIds($ids, $index, $type);
}

return $this->getClient()->deleteIds($ids, $index);
}

Expand Down