Skip to content

Commit

Permalink
Merge pull request #2966 from acrobat/remaining-major-cleanup
Browse files Browse the repository at this point in the history
[AllBundles] More remaining next major clean up
  • Loading branch information
acrobat committed Oct 6, 2021
2 parents 23d4c3c + f45988c commit 3e40097
Show file tree
Hide file tree
Showing 13 changed files with 14 additions and 221 deletions.
1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
"symfony/security-core" : "^3.4|^4.4",
"symfony/security-http" : "^3.4|^4.4",
"symfony/serializer": "^3.4|^4.4",
"symfony/templating": "^3.4|^4.4",
"symfony/translation": "^3.4|^4.4",
"symfony/twig-bundle": "^3.4|^4.4",
"symfony/validator": "^3.4.31|^4.4",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ class KunstmaanAdminExtension extends Extension
*/
public function load(array $configs, ContainerBuilder $container)
{
// NEXT_MAJOR: Remove templating dependency

$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
$loader->load('services.yml');
$loader->load('commands.yml');
Expand Down
6 changes: 2 additions & 4 deletions src/Kunstmaan/AdminBundle/Entity/BaseUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@
use Doctrine\ORM\Mapping as ORM;
use Kunstmaan\AdminBundle\Validator\Constraints\PasswordRestrictions;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Component\Security\Core\User\EquatableInterface;
use Symfony\Component\Security\Core\User\UserInterface as BaseUserInterface;
use Symfony\Component\Validator\Constraints\Email;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Mapping\ClassMetadata;

/**
* NEXT_MAJOR implement EquatableInterface
*/
abstract class BaseUser implements UserInterface
abstract class BaseUser implements UserInterface, EquatableInterface
{
/**
* @ORM\Id
Expand Down
1 change: 0 additions & 1 deletion src/Kunstmaan/AdminBundle/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
"symfony/security-core" : "^3.4|^4.4",
"symfony/security-http" : "^3.4|^4.4",
"symfony/serializer": "^3.4|^4.4",
"symfony/templating": "^3.4|^4.4",
"symfony/translation": "^3.4|^4.4",
"symfony/twig-bundle": "^3.4|^4.4",
"symfony/validator": "^3.4.31|^4.4",
Expand Down
1 change: 0 additions & 1 deletion src/Kunstmaan/AdminListBundle/Service/ExportService.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ protected function streamOutput(ExportableInterface $adminList, $format)
}
$data = $adminList->getStringValue($itemHelper, $columnName);
if (null !== $column->getTemplate()) {
// NEXT_MAJOR: Remove `templateExists` private method and call Twig exists check directly.
if (!$this->twig->getLoader()->exists($column->getTemplate())) {
throw new ExportException('No export template defined for ' . \get_class($data), $data);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,9 @@ abstract class AbstractArticleEntityAdminListController extends AbstractAdminLis
protected $aclHelper;

/**
* NEXT_MAJOR: change method visibility from public to protected
*
* @return AdminListConfiguratorInterface
*/
public function getAdminListConfigurator(Request $request)
protected function getAdminListConfigurator(Request $request)
{
$this->initAdminListConfigurator($request);
if (!isset($this->configurator)) {
Expand All @@ -53,11 +51,9 @@ public function getAdminListConfigurator(Request $request)
}

/**
* NEXT_MAJOR: change method visibility from public to protected
*
* @return AbstractArticlePageAdminListConfigurator
*/
abstract public function createAdminListConfigurator();
abstract protected function createAdminListConfigurator();

protected function initAdminListConfigurator(Request $request)
{
Expand Down
26 changes: 1 addition & 25 deletions src/Kunstmaan/NodeBundle/Helper/NodeAdmin/NodeAdminPublisher.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,12 @@ public function __construct(
AuthorizationCheckerInterface $authorizationChecker,
EventDispatcherInterface $eventDispatcher,
CloneHelper $cloneHelper,
/*TranslatorInterface*/ $translator = null
/*TranslatorInterface*/ $translator
) {
if (null !== $translator && (!$translator instanceof LegacyTranslatorInterface && !$translator instanceof TranslatorInterface)) {
throw new \InvalidArgumentException(sprintf('Argument 6 passed to "%s" must be of the type "%s" or "%s", "%s" given', __METHOD__, LegacyTranslatorInterface::class, TranslatorInterface::class, get_class($translator)));
}

if (null === $translator) {
@trigger_error(sprintf('Not passing the "translator" service as the 6th argument of "%s" is deprecated since KunstmaanNodeBundle 5.9 and will be required in KunstmaanNodeBundle 6.0. Injected the required services in the constructor.', __METHOD__), E_USER_DEPRECATED);
}

$this->em = $em;
$this->tokenStorage = $tokenStorage;
$this->authorizationChecker = $authorizationChecker;
Expand Down Expand Up @@ -325,26 +321,6 @@ public function handleUnpublish(Request $request, NodeTranslation $nodeTranslati
);
}

/**
* @deprecated since KunstmaanNodeBundle 5.9 and will be removed in KunstmaanNodeBundle 6.0. Use `handlePublish` instead.
*/
public function chooseHowToPublish(Request $request, NodeTranslation $nodeTranslation, TranslatorInterface $translator)
{
@trigger_error(sprintf('The "%s" method is deprecated since KunstmaanNodeBundle 5.9 and will be removed in KunstmaanNodeBundle 6.0. Use `handlePublish` instead.', __METHOD__), E_USER_DEPRECATED);

$this->handlePublish($request, $nodeTranslation);
}

/**
* @deprecated since KunstmaanNodeBundle 5.9 and will be removed in KunstmaanNodeBundle 6.0. Use `handleUnpublish` instead.
*/
public function chooseHowToUnpublish(Request $request, NodeTranslation $nodeTranslation, TranslatorInterface $translator)
{
@trigger_error(sprintf('The "%s" method is deprecated since KunstmaanNodeBundle 5.9 and will be removed in KunstmaanNodeBundle 6.0. Use `handleUnpublish` instead.', __METHOD__), E_USER_DEPRECATED);

$this->handleUnpublish($request, $nodeTranslation);
}

/**
* @param object $event
*
Expand Down
16 changes: 0 additions & 16 deletions src/Kunstmaan/NodeSearchBundle/Search/AbstractElasticaSearcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,22 +145,6 @@ public function getIndexName()
return $this->indexName;
}

/**
* @deprecated upgrade to ruflin/elastica and elasticsearch v7 and don't set an index type
*
* @param string $indexType
*
* @return SearcherInterface
*/
public function setIndexType($indexType)
{
@trigger_error(sprintf('The "setIndexType" method in "%s" is deprecated since KunstmaanSearchBundle 5.6 and will be removed in KunstmaanSearchBundle 6.0. Upgrade to ruflin/elastica and elasticsearch v7 and don\'t set an index type.', __CLASS__), E_USER_DEPRECATED);

$this->indexType = $indexType;

return $this;
}

/**
* @param mixed $data
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ public function getConfigTreeBuilder()
->thenInvalid('Invalid search driver %s')
->end()
->end()
->scalarNode('host')->defaultNull()->end() //NEXT_MAJOR: Make config required or define default value (localhost)
->integerNode('port')->defaultNull()->end() //NEXT_MAJOR: Make config required or define default value (9200)
->scalarNode('host')->defaultValue('localhost')->end()
->integerNode('port')->defaultValue(9200)->end()
->scalarNode('username')->defaultNull()->end()
->scalarNode('password')->defaultNull()->end()
->end()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,89 +25,19 @@ public function load(array $configs, ContainerBuilder $container)

$this->loadConnectionParameters($container, $config);

$this->addSearchIndexPrefixParameter($container, $config);
$container->setParameter('kunstmaan_search.index_prefix', $config['index_prefix']);
}

public function getDefaultAnalyzerLanguages()
{
return Yaml::parse(file_get_contents(__DIR__ . '/../Resources/config/analyzer_languages.yml'));
}

private function loadConnectionParameters(ContainerBuilder $container, array $config)
private function loadConnectionParameters(ContainerBuilder $container, array $config): void
{
$this->addHostParameter($container, $config);
$this->addPortParameter($container, $config);
$this->addUserParameter($container, $config);
$this->addPasswordParameter($container, $config);
}

private function addHostParameter(ContainerBuilder $container, array $config)
{
$searchHost = $container->hasParameter('kunstmaan_search.hostname') ? $container->getParameter('kunstmaan_search.hostname') : 'localhost';
if (null === $config['connection']['host'] && $searchHost !== 'localhost') {
@trigger_error('Not providing a value for the "kunstmaan_search.connection.host" config while setting the "kunstmaan_search.hostname" parameter is deprecated since KunstmaanDashboardBundle 5.2, this config value will replace the "kunstmaan_search.hostname" parameter in KunstmaanDashboardBundle 6.0.', E_USER_DEPRECATED);
}

if (null !== $config['connection']['host']) {
$searchHost = $config['connection']['host'];
}

$container->setParameter('kunstmaan_search.hostname', $searchHost);
}

private function addPortParameter(ContainerBuilder $container, array $config)
{
$searchPort = $container->hasParameter('kunstmaan_search.port') ? $container->getParameter('kunstmaan_search.port') : 9200;
if (null === $config['connection']['port'] && $searchPort !== 9200) {
@trigger_error('Not providing a value for the "kunstmaan_search.connection.port" config while setting the "kunstmaan_search.port" parameter is deprecated since KunstmaanDashboardBundle 5.2, this config value will replace the "kunstmaan_search.port" parameter in KunstmaanDashboardBundle 6.0.', E_USER_DEPRECATED);
}

if (null !== $config['connection']['port']) {
$searchPort = $config['connection']['port'];
}

$container->setParameter('kunstmaan_search.port', $searchPort);
}

private function addUserParameter(ContainerBuilder $container, array $config)
{
$searchUsername = $container->hasParameter('kunstmaan_search.username') ? $container->getParameter('kunstmaan_search.username') : null;
if (null === $config['connection']['username'] && null !== $searchUsername) {
@trigger_error('Not providing a value for the "kunstmaan_search.connection.username" config while setting the "kunstmaan_search.username" parameter is deprecated since KunstmaanDashboardBundle 5.2, this config value will replace the "kunstmaan_search.username" parameter in KunstmaanDashboardBundle 6.0.', E_USER_DEPRECATED);
}

if (null !== $config['connection']['username']) {
$searchUsername = $config['connection']['username'];
}

$container->setParameter('kunstmaan_search.username', $searchUsername);
}

private function addPasswordParameter(ContainerBuilder $container, array $config)
{
$searchPassword = $container->hasParameter('kunstmaan_search.password') ? $container->getParameter('kunstmaan_search.password') : null;
if (null === $config['connection']['password'] && null !== $searchPassword) {
@trigger_error('Not providing a value for the "kunstmaan_search.connection.password" config while setting the "kunstmaan_search.password" parameter is deprecated since KunstmaanDashboardBundle 5.2, this config value will replace the "kunstmaan_search.password" parameter in KunstmaanDashboardBundle 6.0.', E_USER_DEPRECATED);
}

if (null !== $config['connection']['password']) {
$searchPassword = $config['connection']['password'];
}

$container->setParameter('kunstmaan_search.password', $searchPassword);
}

private function addSearchIndexPrefixParameter(ContainerBuilder $container, array $config)
{
$indexPrefix = $container->hasParameter('searchindexprefix') ? $container->getParameter('searchindexprefix') : null;
if (null === $config['index_prefix'] && null !== $indexPrefix) {
@trigger_error('Not providing a value for the "kunstmaan_search.index_prefix" config while setting the "searchindexprefix" parameter is deprecated since KunstmaanDashboardBundle 5.2, this config value will replace the "searchindexprefix" parameter in KunstmaanDashboardBundle 6.0.', E_USER_DEPRECATED);
}

if (null !== $config['index_prefix']) {
$indexPrefix = $config['index_prefix'];
}

$container->setParameter('kunstmaan_search.index_prefix', $indexPrefix);
$container->setParameter('kunstmaan_search.hostname', $config['connection']['host']);
$container->setParameter('kunstmaan_search.port', $config['connection']['port']);
$container->setParameter('kunstmaan_search.username', $config['connection']['username']);
$container->setParameter('kunstmaan_search.password', $config['connection']['password']);
}
}
5 changes: 0 additions & 5 deletions src/Kunstmaan/SearchBundle/Provider/ElasticaProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@ public function getClient()
['connections' => $this->nodes,
]
);

//NEXT_MAJOR: remove checks and update ruflin/elastica dependency constraints
if (!class_exists(\Elastica\Mapping::class)) {
@trigger_error('Using a version of ruflin/elastica below v7.0 is deprecated since KunstmaanSearchBundle 5.6 and support for older versions will be removed in KunstmaanSearchBundle 6.0. Upgrade to ruflin/elastica and elasticsearch v7 instead.', E_USER_DEPRECATED);
}
}

return $this->client;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,6 @@ public function testConnectionHostWithnoConfig()
$this->assertContainerBuilderHasParameter('kunstmaan_search.hostname', 'localhost');
}

/**
* @group legacy
* @expectedDeprecation Not providing a value for the "kunstmaan_search.connection.host" config while setting the "kunstmaan_search.hostname" parameter is deprecated since KunstmaanDashboardBundle 5.2, this config value will replace the "kunstmaan_search.hostname" parameter in KunstmaanDashboardBundle 6.0.
*/
public function testConnectionHostWithParameterSet()
{
$this->setParameter('kunstmaan_search.hostname', '127.0.0.1');

$this->load();

$this->assertContainerBuilderHasParameter('kunstmaan_search.hostname', '127.0.0.1');
}

public function testConnectionHostWithParameterAndConfigSet()
{
$this->setParameter('kunstmaan_search.hostname', '127.0.0.1');
Expand All @@ -65,19 +52,6 @@ public function testConnectionPortWithnoConfig()
$this->assertContainerBuilderHasParameter('kunstmaan_search.port', 9200);
}

/**
* @group legacy
* @expectedDeprecation Not providing a value for the "kunstmaan_search.connection.port" config while setting the "kunstmaan_search.port" parameter is deprecated since KunstmaanDashboardBundle 5.2, this config value will replace the "kunstmaan_search.port" parameter in KunstmaanDashboardBundle 6.0.
*/
public function testConnectionPortWithParameterSet()
{
$this->setParameter('kunstmaan_search.port', 9300);

$this->load();

$this->assertContainerBuilderHasParameter('kunstmaan_search.port', 9300);
}

public function testConnectionPortWithParameterAndConfigSet()
{
$this->setParameter('kunstmaan_search.port', 9300);
Expand All @@ -94,19 +68,6 @@ public function testConnectionUsernameWithnoConfig()
$this->assertContainerBuilderHasParameter('kunstmaan_search.username', null);
}

/**
* @group legacy
* @expectedDeprecation Not providing a value for the "kunstmaan_search.connection.username" config while setting the "kunstmaan_search.username" parameter is deprecated since KunstmaanDashboardBundle 5.2, this config value will replace the "kunstmaan_search.username" parameter in KunstmaanDashboardBundle 6.0.
*/
public function testConnectionUsernameWithParameterSet()
{
$this->setParameter('kunstmaan_search.username', 'user');

$this->load();

$this->assertContainerBuilderHasParameter('kunstmaan_search.username', 'user');
}

public function testConnectionUsernameWithParameterAndConfigSet()
{
$this->setParameter('kunstmaan_search.username', 'user');
Expand All @@ -123,19 +84,6 @@ public function testConnectionPasswordWithnoConfig()
$this->assertContainerBuilderHasParameter('kunstmaan_search.password', null);
}

/**
* @group legacy
* @expectedDeprecation Not providing a value for the "kunstmaan_search.connection.password" config while setting the "kunstmaan_search.password" parameter is deprecated since KunstmaanDashboardBundle 5.2, this config value will replace the "kunstmaan_search.password" parameter in KunstmaanDashboardBundle 6.0.
*/
public function testConnectionPasswordWithParameterSet()
{
$this->setParameter('kunstmaan_search.password', 'password');

$this->load();

$this->assertContainerBuilderHasParameter('kunstmaan_search.password', 'password');
}

public function testConnectionPasswordWithParameterAndConfigSet()
{
$this->setParameter('kunstmaan_search.password', 'password');
Expand All @@ -152,19 +100,6 @@ public function testIndexPrefixWithNoConfig()
$this->assertContainerBuilderHasParameter('kunstmaan_search.index_prefix', null);
}

/**
* @group legacy
* @expectedDeprecation Not providing a value for the "kunstmaan_search.index_prefix" config while setting the "searchindexprefix" parameter is deprecated since KunstmaanDashboardBundle 5.2, this config value will replace the "searchindexprefix" parameter in KunstmaanDashboardBundle 6.0.
*/
public function testIndexPrefixWithParameterSet()
{
$this->setParameter('searchindexprefix', 'prefix');

$this->load();

$this->assertContainerBuilderHasParameter('kunstmaan_search.index_prefix', 'prefix');
}

public function testIndexPrefixWithParameterAndConfigSet()
{
$this->setParameter('searchindexprefix', 'prefix');
Expand Down
Loading

0 comments on commit 3e40097

Please sign in to comment.