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

Pimcore 10 Compatibility #4

Merged
merged 10 commits into from
Mar 11, 2024
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
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# License
Copyright (C) 2016-2020 w-vision AG
Copyright (C) 2016-2022 w-vision AG

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1 +1,17 @@
# Element Manager Bundle


### Requirements
* Pimcore `^10.0`

### Installation

- Install with composer
```
composer require w-vision/element-manager-bundle:^2.0
```

- Run enable Bundle command
```
bin/console pimcore:bundle:enable ElementManagerBundle
```
9 changes: 4 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
],
"require": {
"league/csv": "^9.0",
"coreshop/resource-bundle": "^2.0"
"coreshop/resource-bundle": "^3.0"
},
"suggest": {
"pimcore/object-merger": "To directly merge duplicates"
Expand All @@ -42,9 +42,8 @@
"bundles": [
"Wvision\\Bundle\\ElementManagerBundle\\ElementManagerBundle"
]
},
"branch-alias": {
"dev-master": "1.0-dev"
}
}
},
"minimum-stability": "dev",
"prefer-stable": true
}
2 changes: 1 addition & 1 deletion src/ElementManagerBundle/Command/IndexCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* For the full copyright and license information, please view the LICENSE.md and gpl-3.0.txt
* files that are distributed with this source code.
*
* @copyright Copyright (c) 2016-2020 w-vision AG (https://www.w-vision.ch)
* @copyright Copyright (c) 2016-2022 w-vision AG (https://www.w-vision.ch)
* @license https://github.com/w-vision/ImportDefinitions/blob/master/gpl-3.0.txt GNU General Public License version 3 (GPLv3)
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@
* For the full copyright and license information, please view the LICENSE.md and gpl-3.0.txt
* files that are distributed with this source code.
*
* @copyright Copyright (c) 2016-2020 w-vision AG (https://www.w-vision.ch)
* @copyright Copyright (c) 2016-2022 w-vision AG (https://www.w-vision.ch)
* @license https://github.com/w-vision/ImportDefinitions/blob/master/gpl-3.0.txt GNU General Public License version 3 (GPLv3)
*/

namespace Wvision\Bundle\ElementManagerBundle\Controller\Admin;

use CoreShop\Bundle\ResourceBundle\Controller\ResourceController;
use CoreShop\Component\Resource\Model\ResourceInterface;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
Expand All @@ -32,7 +33,7 @@ final class DuplicatesIndexController extends ResourceController
*
* @return JsonResponse
*/
public function listAction(Request $request)
public function listAction(Request $request): JsonResponse
{
return $this->viewHandler->handle($this->getMetadataRegistry()->all(), ['group' => 'List']);
}
Expand All @@ -42,7 +43,7 @@ public function listAction(Request $request)
*
* @return JsonResponse
*/
public function getAction(Request $request)
public function getAction(Request $request): JsonResponse
{
$this->isGrantedOr403();

Expand Down Expand Up @@ -185,7 +186,7 @@ public function unDeclineDuplicationAction(Request $request)
*
* @throws NotFoundHttpException
*/
protected function findOr404($className)
protected function findOr404($className): ResourceInterface
{
if (!$this->getMetadataRegistry()->has($className)) {
throw new NotFoundHttpException(sprintf('The "%s" has not been found', $className));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* For the full copyright and license information, please view the LICENSE.md and gpl-3.0.txt
* files that are distributed with this source code.
*
* @copyright Copyright (c) 2016-2020 w-vision AG (https://www.w-vision.ch)
* @copyright Copyright (c) 2016-2022 w-vision AG (https://www.w-vision.ch)
* @license https://github.com/w-vision/ImportDefinitions/blob/master/gpl-3.0.txt GNU General Public License version 3 (GPLv3)
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* For the full copyright and license information, please view the LICENSE.md and gpl-3.0.txt
* files that are distributed with this source code.
*
* @copyright Copyright (c) 2016-2020 w-vision AG (https://www.w-vision.ch)
* @copyright Copyright (c) 2016-2022 w-vision AG (https://www.w-vision.ch)
* @license https://github.com/w-vision/ImportDefinitions/blob/master/gpl-3.0.txt GNU General Public License version 3 (GPLv3)
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* For the full copyright and license information, please view the LICENSE.md and gpl-3.0.txt
* files that are distributed with this source code.
*
* @copyright Copyright (c) 2016-2020 w-vision AG (https://www.w-vision.ch)
* @copyright Copyright (c) 2016-2022 w-vision AG (https://www.w-vision.ch)
* @license https://github.com/w-vision/ImportDefinitions/blob/master/gpl-3.0.txt GNU General Public License version 3 (GPLv3)
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* For the full copyright and license information, please view the LICENSE.md and gpl-3.0.txt
* files that are distributed with this source code.
*
* @copyright Copyright (c) 2016-2020 w-vision AG (https://www.w-vision.ch)
* @copyright Copyright (c) 2016-2022 w-vision AG (https://www.w-vision.ch)
* @license https://github.com/w-vision/ImportDefinitions/blob/master/gpl-3.0.txt GNU General Public License version 3 (GPLv3)
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* For the full copyright and license information, please view the LICENSE.md and gpl-3.0.txt
* files that are distributed with this source code.
*
* @copyright Copyright (c) 2016-2020 w-vision AG (https://www.w-vision.ch)
* @copyright Copyright (c) 2016-2022 w-vision AG (https://www.w-vision.ch)
* @license https://github.com/w-vision/ImportDefinitions/blob/master/gpl-3.0.txt GNU General Public License version 3 (GPLv3)
*/

Expand All @@ -22,7 +22,6 @@
use Wvision\Bundle\ElementManagerBundle\Metadata\DuplicatesIndex\GroupMetadata;
use Wvision\Bundle\ElementManagerBundle\Metadata\DuplicatesIndex\Metadata;
use Wvision\Bundle\ElementManagerBundle\Metadata\DuplicatesIndex\MetadataRegistry;
use Wvision\Bundle\ElementManagerBundle\Metadata\DuplicatesIndex\MetadataRegistryInterface;
use Wvision\Bundle\ElementManagerBundle\SaveManager\DuplicationSaveHandler;
use Wvision\Bundle\ElementManagerBundle\SaveManager\NamingSchemeSaveHandler;
use Wvision\Bundle\ElementManagerBundle\SaveManager\ObjectSaveManagers;
Expand All @@ -49,10 +48,11 @@ public function load(array $configs, ContainerBuilder $container): void
$configuration = new Configuration();
$config = $this->processConfiguration($configuration, $configs);

$loader->load('services.yml');
$loader->load('services/data_transformer.yml');
$loader->load('services/similarity_checker.yml');
$loader->load('services/commands.yml');
$loader->load('services.yaml');
$loader->load('services/data_transformer.yaml');
$loader->load('services/duplication.yaml');
$loader->load('services/similarity_checker.yaml');
$loader->load('services/commands.yaml');

$this->registerResources(
'wvision_element_manager',
Expand Down Expand Up @@ -104,10 +104,11 @@ private function registerSaveManagerConfiguration(
array $config,
Loader\YamlFileLoader $loader
): void {
$loader->load('services/save_manager.yml');
$loader->load('services/save_manager.yaml');

$definition = new Definition($config['save_manager_class']);


$options = [
'naming_scheme' => $config['naming_scheme']['options'],
'duplicates' => $config['duplicates']['options'],
Expand Down Expand Up @@ -173,26 +174,27 @@ private function registerDuplicationCheckerConfiguration(
ContainerBuilder $container,
Loader\YamlFileLoader $loader
): void {
$loader->load('services/duplication.yml');
$loader->load('services/duplication.yaml');

$duplicationBuilder = $container->getDefinition('duplication_checker.builder');

$files = ['yml' => []];
$files = ['yaml' => []];
$this->registerDuplicationCheckerMapping($container, $config, $files);

if (!empty($files['yml'])) {
$duplicationBuilder->addMethodCall('addYamlMappings', [$files['yml']]);
if (!empty($files['yaml'])) {
$duplicationBuilder->addMethodCall('addYamlMappings', [$files['yaml']]);
}

if (!empty($files['xml'])) {
$duplicationBuilder->addMethodCall('addXmlMappings', [$files['yml']]);
$duplicationBuilder->addMethodCall('addXmlMappings', [$files['yaml']]);
}

if (!$container->getParameter('kernel.debug')) {
$duplicationBuilder->addMethodCall('setMetadataCache', [
new Reference('duplication_checker.mapping.cache.symfony'),
]);
}
// ToDo refactor Caching
// if (!$container->getParameter('kernel.debug')) {
// $duplicationBuilder->addMethodCall('setMetadataCache', [
// new Reference('duplication_checker.mapping.cache.symfony'),
// ]);
// }
}

/**
Expand All @@ -203,16 +205,16 @@ private function registerDuplicationCheckerConfiguration(
private function registerDuplicationCheckerMapping(ContainerBuilder $container, array $config, array &$files): void
{
$fileRecorder = static function ($extension, $path) use (&$files) {
$files['yaml' === $extension ? 'yml' : $extension][] = $path;
$files['yaml' === $extension ? 'yaml' : $extension][] = $path;
};

foreach ($container->getParameter('kernel.bundles_metadata') as $bundle) {
$dirname = $bundle['path'];

if ($container->fileExists($file = $dirname . '/Resources/config/duplication.yaml', false) ||
$container->fileExists($file = $dirname . '/Resources/config/duplication.yml', false)
$container->fileExists($file = $dirname . '/Resources/config/duplication.yaml', false)
) {
$fileRecorder('yml', $file);
$fileRecorder('yaml', $file);
}

if ($container->fileExists($file = $dirname . '/Resources/config/duplication.xml', false)) {
Expand Down Expand Up @@ -285,7 +287,8 @@ private function registerDuplicateIndexConfiguration(
string $className,
array $config
): void {
if (!$config['enabled']) {

if (!$config || !$config['enabled']) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* For the full copyright and license information, please view the LICENSE.md and gpl-3.0.txt
* files that are distributed with this source code.
*
* @copyright Copyright (c) 2016-2020 w-vision AG (https://www.w-vision.ch)
* @copyright Copyright (c) 2016-2022 w-vision AG (https://www.w-vision.ch)
* @license https://github.com/w-vision/ImportDefinitions/blob/master/gpl-3.0.txt GNU General Public License version 3 (GPLv3)
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* For the full copyright and license information, please view the LICENSE.md and gpl-3.0.txt
* files that are distributed with this source code.
*
* @copyright Copyright (c) 2016-2020 w-vision AG (https://www.w-vision.ch)
* @copyright Copyright (c) 2016-2022 w-vision AG (https://www.w-vision.ch)
* @license https://github.com/w-vision/ImportDefinitions/blob/master/gpl-3.0.txt GNU General Public License version 3 (GPLv3)
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* For the full copyright and license information, please view the LICENSE.md and gpl-3.0.txt
* files that are distributed with this source code.
*
* @copyright Copyright (c) 2016-2020 w-vision AG (https://www.w-vision.ch)
* @copyright Copyright (c) 2016-2022 w-vision AG (https://www.w-vision.ch)
* @license https://github.com/w-vision/ImportDefinitions/blob/master/gpl-3.0.txt GNU General Public License version 3 (GPLv3)
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* For the full copyright and license information, please view the LICENSE.md and gpl-3.0.txt
* files that are distributed with this source code.
*
* @copyright Copyright (c) 2016-2020 w-vision AG (https://www.w-vision.ch)
* @copyright Copyright (c) 2016-2022 w-vision AG (https://www.w-vision.ch)
* @license https://github.com/w-vision/ImportDefinitions/blob/master/gpl-3.0.txt GNU General Public License version 3 (GPLv3)
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* For the full copyright and license information, please view the LICENSE.md and gpl-3.0.txt
* files that are distributed with this source code.
*
* @copyright Copyright (c) 2016-2020 w-vision AG (https://www.w-vision.ch)
* @copyright Copyright (c) 2016-2022 w-vision AG (https://www.w-vision.ch)
* @license https://github.com/w-vision/ImportDefinitions/blob/master/gpl-3.0.txt GNU General Public License version 3 (GPLv3)
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* For the full copyright and license information, please view the LICENSE.md and gpl-3.0.txt
* files that are distributed with this source code.
*
* @copyright Copyright (c) 2016-2020 w-vision AG (https://www.w-vision.ch)
* @copyright Copyright (c) 2016-2022 w-vision AG (https://www.w-vision.ch)
* @license https://github.com/w-vision/ImportDefinitions/blob/master/gpl-3.0.txt GNU General Public License version 3 (GPLv3)
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* For the full copyright and license information, please view the LICENSE.md and gpl-3.0.txt
* files that are distributed with this source code.
*
* @copyright Copyright (c) 2016-2020 w-vision AG (https://www.w-vision.ch)
* @copyright Copyright (c) 2016-2022 w-vision AG (https://www.w-vision.ch)
* @license https://github.com/w-vision/ImportDefinitions/blob/master/gpl-3.0.txt GNU General Public License version 3 (GPLv3)
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* For the full copyright and license information, please view the LICENSE.md and gpl-3.0.txt
* files that are distributed with this source code.
*
* @copyright Copyright (c) 2016-2020 w-vision AG (https://www.w-vision.ch)
* @copyright Copyright (c) 2016-2022 w-vision AG (https://www.w-vision.ch)
* @license https://github.com/w-vision/ImportDefinitions/blob/master/gpl-3.0.txt GNU General Public License version 3 (GPLv3)
*/

Expand All @@ -20,7 +20,7 @@ interface DuplicateServiceInterface
{
/**
* @param ElementInterface $element
* @param array $groups
* @param array|null $groups
*
* @return ElementInterface[]
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* For the full copyright and license information, please view the LICENSE.md and gpl-3.0.txt
* files that are distributed with this source code.
*
* @copyright Copyright (c) 2016-2020 w-vision AG (https://www.w-vision.ch)
* @copyright Copyright (c) 2016-2022 w-vision AG (https://www.w-vision.ch)
* @license https://github.com/w-vision/ImportDefinitions/blob/master/gpl-3.0.txt GNU General Public License version 3 (GPLv3)
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* For the full copyright and license information, please view the LICENSE.md and gpl-3.0.txt
* files that are distributed with this source code.
*
* @copyright Copyright (c) 2016-2020 w-vision AG (https://www.w-vision.ch)
* @copyright Copyright (c) 2016-2022 w-vision AG (https://www.w-vision.ch)
* @license https://github.com/w-vision/ImportDefinitions/blob/master/gpl-3.0.txt GNU General Public License version 3 (GPLv3)
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* For the full copyright and license information, please view the LICENSE.md and gpl-3.0.txt
* files that are distributed with this source code.
*
* @copyright Copyright (c) 2016-2020 w-vision AG (https://www.w-vision.ch)
* @copyright Copyright (c) 2016-2022 w-vision AG (https://www.w-vision.ch)
* @license https://github.com/w-vision/ImportDefinitions/blob/master/gpl-3.0.txt GNU General Public License version 3 (GPLv3)
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* For the full copyright and license information, please view the LICENSE.md and gpl-3.0.txt
* files that are distributed with this source code.
*
* @copyright Copyright (c) 2016-2020 w-vision AG (https://www.w-vision.ch)
* @copyright Copyright (c) 2016-2022 w-vision AG (https://www.w-vision.ch)
* @license https://github.com/w-vision/ImportDefinitions/blob/master/gpl-3.0.txt GNU General Public License version 3 (GPLv3)
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* For the full copyright and license information, please view the LICENSE.md and gpl-3.0.txt
* files that are distributed with this source code.
*
* @copyright Copyright (c) 2016-2020 w-vision AG (https://www.w-vision.ch)
* @copyright Copyright (c) 2016-2022 w-vision AG (https://www.w-vision.ch)
* @license https://github.com/w-vision/ImportDefinitions/blob/master/gpl-3.0.txt GNU General Public License version 3 (GPLv3)
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* For the full copyright and license information, please view the LICENSE.md and gpl-3.0.txt
* files that are distributed with this source code.
*
* @copyright Copyright (c) 2016-2020 w-vision AG (https://www.w-vision.ch)
* @copyright Copyright (c) 2016-2022 w-vision AG (https://www.w-vision.ch)
* @license https://github.com/w-vision/ImportDefinitions/blob/master/gpl-3.0.txt GNU General Public License version 3 (GPLv3)
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* For the full copyright and license information, please view the LICENSE.md and gpl-3.0.txt
* files that are distributed with this source code.
*
* @copyright Copyright (c) 2016-2020 w-vision AG (https://www.w-vision.ch)
* @copyright Copyright (c) 2016-2022 w-vision AG (https://www.w-vision.ch)
* @license https://github.com/w-vision/ImportDefinitions/blob/master/gpl-3.0.txt GNU General Public License version 3 (GPLv3)
*/

Expand Down
Loading