From d0367d76e1a426bc348e170b2d0bb3b9af198899 Mon Sep 17 00:00:00 2001 From: jeremycr <32451794+jeremycr@users.noreply.github.com> Date: Fri, 21 Jul 2023 14:29:09 +0200 Subject: [PATCH] Ibexa 4 support (#42) --- .github/workflows/php.yml | 2 +- CHANGELOG.md | 4 + README.md | 47 +-- composer.json | 19 +- src/CodeRhapsodieEzDataflowBundle.php | 8 +- src/Controller/DashboardController.php | 28 +- src/Controller/JobController.php | 20 +- .../ScheduledDataflowController.php | 33 +- src/Core/Content/ContentCreator.php | 30 +- src/Core/Content/ContentCreatorInterface.php | 2 +- src/Core/Content/ContentUpdater.php | 26 +- src/Core/Content/ContentUpdaterInterface.php | 2 +- src/Core/Field/ContentStructFieldFiller.php | 12 +- .../ContentStructFieldFillerInterface.php | 4 +- src/Core/Field/DefaultFieldValueCreator.php | 6 +- src/Core/Field/FieldValueCreatorInterface.php | 2 +- .../AbstractFieldComparator.php | 8 +- .../DelegatorFieldComparator.php | 2 +- .../FieldComparatorInterface.php | 2 +- .../MapLocationFieldComparator.php | 2 +- .../FieldComparator/MatrixFieldComparator.php | 2 +- .../NovaSEOMetasFieldComparator.php | 2 +- .../FieldComparator/SimpleFieldComparator.php | 2 +- .../FieldComparator/UrlFieldComparator.php | 2 +- src/DependencyInjection/Configuration.php | 8 +- src/EventSubscriber/MenuSubscriber.php | 7 +- src/Factory/ContentStructureFactory.php | 13 +- src/Filter/NotModifiedContentFilter.php | 6 +- src/Form/DataflowTypeChoiceType.php | 2 +- .../UserTimezoneAwareDateTimeTransformer.php | 6 +- src/Form/UserTimezoneAwareDateTimeType.php | 4 +- src/Gateway/JobGateway.php | 2 +- src/Gateway/ScheduledDataflowGateway.php | 2 +- src/Matcher/LocationMatcher.php | 12 +- src/Matcher/LocationMatcherInterface.php | 2 +- src/Model/ContentCreateStructure.php | 8 +- src/Resources/config/services.yaml | 48 ++- src/Resources/translations/menu.en.yaml | 1 + src/Resources/translations/menu.fr.yaml | 1 + src/Resources/translations/messages.fr.yaml | 5 + .../ezdataflow/Dashboard/history.html.twig | 81 +++-- .../admin/ezdataflow/Dashboard/main.html.twig | 139 ++++---- .../ezdataflow/Dashboard/oneshot.html.twig | 103 +++--- .../ezdataflow/Dashboard/repeating.html.twig | 309 ++++++++---------- .../Dashboard/schedule_history.html.twig | 12 +- .../admin/ezdataflow/Item/details.html.twig | 8 +- .../admin/ezdataflow/form_theme.html.twig | 10 + .../ezdataflow/parts/form_modal.html.twig | 23 ++ .../ezdataflow/parts/schedule_form.html.twig | 24 -- .../ezdataflow/parts/tab/ezdataflow.html.twig | 27 -- .../ezdataflow/parts/tab/job_list.html.twig | 166 ++++++---- .../parts/tab/schedule_list.html.twig | 224 ++++++++----- src/Security/PolicyProvider.php | 4 +- src/Tab/HistoryTab.php | 4 +- src/Tab/OneshotTab.php | 4 +- src/Tab/RepeatingTab.php | 4 +- src/UserSwitcher/UserSwitcher.php | 11 +- src/Writer/ContentWriter.php | 12 +- .../DelegatorFieldComparatorTest.php | 4 +- tests/Filter/NotModifiedContentFilterTest.php | 12 +- 60 files changed, 813 insertions(+), 762 deletions(-) create mode 100644 src/Resources/translations/menu.en.yaml create mode 100644 src/Resources/translations/menu.fr.yaml create mode 100644 src/Resources/views/themes/admin/ezdataflow/form_theme.html.twig create mode 100644 src/Resources/views/themes/admin/ezdataflow/parts/form_modal.html.twig delete mode 100644 src/Resources/views/themes/admin/ezdataflow/parts/schedule_form.html.twig delete mode 100644 src/Resources/views/themes/admin/ezdataflow/parts/tab/ezdataflow.html.twig diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 02eb017..b0dc600 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -12,7 +12,7 @@ jobs: strategy: fail-fast: false matrix: - php-version: [7.3, 7.4, 8.0, 8.1] + php-version: [7.4, 8.0, 8.1, 8.2] runs-on: ubuntu-latest diff --git a/CHANGELOG.md b/CHANGELOG.md index fd7c4fb..b80319b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# Version 4.0.0 + +* Add compatibility with Ibexa 4.0+ and drop compatibility for eZPlatform 2 and Ibexa 3 + # Version 3.2.0 * Fixed History page pagination is hidden by footer on Ibexa 3.3 #38 diff --git a/README.md b/README.md index 25e38c3..339af47 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Code Rhapsodie eZ Dataflow Bundle -EzDataflowBundle is a bundle integrating [Code Rhapsodie Dataflow bundle](https://github.com/code-rhapsodie/dataflow-bundle) into eZ Platfom 2.0+. -Dataflows can be piloted from an interface integrated in eZ Platform backoffice. +EzDataflowBundle is a bundle integrating [Code Rhapsodie Dataflow bundle](https://github.com/code-rhapsodie/dataflow-bundle) into Ibexa 4.0+. +Dataflows can be piloted from an interface integrated into the Ibexa backoffice. EzDataflow bundle is intended to manage content imports from external data sources. > Note: before using this bundle, please read the [Code Rhapsodie Dataflow bundle documentation](https://github.com/code-rhapsodie/dataflow-bundle/blob/master/README.md). @@ -28,9 +28,7 @@ $ composer require code-rhapsodie/ezdataflow-bundle > Note: The loading order between the Dataflow bundle and Ez Dataflow bundle is important. Dataflow must be loaded first. -#### Symfony 4 (new tree) - -For Symfony 4, add those two lines in the `config/bundles.php` file: +Add those two lines in the `config/bundles.php` file: ```php ` with the `` replaced by the data id provided by the reader. -To check if the content exists or not, I use the service `ContentService` provided by eZ Platform. +To check if the content exists or not, I use the service `ContentService` provided by Ibexa. The step is added as an anonymous function and has 3 types of return values: * When the step returns `false`, the data is dropped. -* When the step returns a `ContentCreateStructure`, the data will be saved into a new eZ Platform content. -* When the step returns a `ContentUpdateStructure`, the existing eZ Platform content will be updated by overwriting all defined fields in the data. +* When the step returns a `ContentCreateStructure`, the data will be saved into a new Ibexa content. +* When the step returns a `ContentUpdateStructure`, the existing Ibexa content will be updated by overwriting all defined fields in the data. For the new content, you must provide one or more "parent location id" as the 3rd argument of the `ContentCreateStructure` constructor. In this example, I have added a new folder to store all articles. -To get the location id of the parent eZ Platform content, go to the admin UI and select the future parent content, click on the details tabs, and read the "Location id" like this: +To get the location id of the parent Ibexa content, go to the admin UI and select the future parent content, click on the details tabs, and read the "Location id" like this: ![parent folder](src/Resources/doc/dest_folder.jpg) @@ -272,7 +251,7 @@ If you want to add support for a field type, simply create your own comparator. addCompilerPass(new FieldComparatorCompilerPass()); - /** @var EzPublishCoreExtension $eZExtension */ - $eZExtension = $container->getExtension('ezpublish'); - $eZExtension->addPolicyProvider(new PolicyProvider()); + /** @var IbexaCoreExtension $ibexaExtension */ + $ibexaExtension = $container->getExtension('ibexa'); + $ibexaExtension->addPolicyProvider(new PolicyProvider()); } } diff --git a/src/Controller/DashboardController.php b/src/Controller/DashboardController.php index e7b12ef..1b1d2bf 100644 --- a/src/Controller/DashboardController.php +++ b/src/Controller/DashboardController.php @@ -11,9 +11,9 @@ use CodeRhapsodie\EzDataflowBundle\Gateway\JobGateway; use CodeRhapsodie\EzDataflowBundle\Gateway\ScheduledDataflowGateway; use Doctrine\DBAL\Query\QueryBuilder; -use eZ\Publish\Core\MVC\Symfony\Security\Authorization\Attribute; -use EzSystems\EzPlatformAdminUiBundle\Controller\Controller; -use Pagerfanta\Adapter\DoctrineDbalAdapter; +use Ibexa\Contracts\AdminUi\Controller\Controller; +use Ibexa\Core\MVC\Symfony\Security\Authorization\Attribute; +use Pagerfanta\Doctrine\DBAL\QueryAdapter; use Pagerfanta\Pagerfanta; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; @@ -24,9 +24,9 @@ */ class DashboardController extends Controller { - /** @var JobGateway */ + /** @var \CodeRhapsodie\EzDataflowBundle\Gateway\JobGateway */ private $jobGateway; - /** @var ScheduledDataflowGateway */ + /** @var \CodeRhapsodie\EzDataflowBundle\Gateway\ScheduledDataflowGateway */ private $scheduledDataflowGateway; public function __construct(JobGateway $jobGateway, ScheduledDataflowGateway $scheduledDataflowGateway) @@ -42,7 +42,7 @@ public function main(): Response { $this->denyAccessUnlessGranted(new Attribute('ezdataflow', 'view')); - return $this->render('@ezdesign/ezdataflow/Dashboard/main.html.twig'); + return $this->render('@ibexadesign/ezdataflow/Dashboard/main.html.twig'); } public function repeating(Request $request): Response @@ -55,7 +55,7 @@ public function repeating(Request $request): Response 'action' => $this->generateUrl('coderhapsodie.ezdataflow.workflow.create'), ]); - return $this->render('@ezdesign/ezdataflow/Dashboard/repeating.html.twig', [ + return $this->render('@ibexadesign/ezdataflow/Dashboard/repeating.html.twig', [ 'pager' => $this->getPager($this->scheduledDataflowGateway->getListQueryForAdmin(), $request), 'form' => $form->createView(), ]); @@ -68,7 +68,7 @@ public function getRepeatingPage(Request $request): Response { $this->denyAccessUnlessGranted(new Attribute('ezdataflow', 'view')); - return $this->render('@ezdesign/ezdataflow/Dashboard/repeating.html.twig', [ + return $this->render('@ibexadesign/ezdataflow/Dashboard/repeating.html.twig', [ 'pager' => $this->getPager($this->scheduledDataflowGateway->getListQueryForAdmin(), $request), ]); } @@ -83,7 +83,7 @@ public function oneshot(Request $request): Response 'action' => $this->generateUrl('coderhapsodie.ezdataflow.job.create'), ]); - return $this->render('@ezdesign/ezdataflow/Dashboard/oneshot.html.twig', [ + return $this->render('@ibexadesign/ezdataflow/Dashboard/oneshot.html.twig', [ 'pager' => $this->getPager($this->jobGateway->getOneshotListQueryForAdmin(), $request), 'form' => $form->createView(), ]); @@ -96,7 +96,7 @@ public function getOneshotPage(Request $request): Response { $this->denyAccessUnlessGranted(new Attribute('ezdataflow', 'view')); - return $this->render('@ezdesign/ezdataflow/Dashboard/oneshot.html.twig', [ + return $this->render('@ibexadesign/ezdataflow/Dashboard/oneshot.html.twig', [ 'pager' => $this->getPager($this->jobGateway->getOneshotListQueryForAdmin(), $request), ]); } @@ -106,7 +106,7 @@ public function history(Request $request): Response $this->denyAccessUnlessGranted(new Attribute('ezdataflow', 'view')); $filter = (int) $request->query->get('filter', JobGateway::FILTER_NONE); - return $this->render('@ezdesign/ezdataflow/Dashboard/history.html.twig', [ + return $this->render('@ibexadesign/ezdataflow/Dashboard/history.html.twig', [ 'pager' => $this->getPager($this->jobGateway->getListQueryForAdmin($filter), $request), 'filter' => $filter, ]); @@ -120,7 +120,7 @@ public function getHistoryPage(Request $request): Response $this->denyAccessUnlessGranted(new Attribute('ezdataflow', 'view')); $filter = (int) $request->query->get('filter', JobGateway::FILTER_NONE); - return $this->render('@ezdesign/ezdataflow/Dashboard/history.html.twig', [ + return $this->render('@ibexadesign/ezdataflow/Dashboard/history.html.twig', [ 'pager' => $this->getPager($this->jobGateway->getListQueryForAdmin($filter), $request), 'filter' => $filter, ]); @@ -133,7 +133,7 @@ public function getHistoryForScheduled(Request $request, int $id): Response { $this->denyAccessUnlessGranted(new Attribute('ezdataflow', 'view')); - return $this->render('@ezdesign/ezdataflow/Dashboard/schedule_history.html.twig', [ + return $this->render('@ibexadesign/ezdataflow/Dashboard/schedule_history.html.twig', [ 'id' => $id, 'pager' => $this->getPager($this->jobGateway->getListQueryForScheduleAdmin($id), $request), ]); @@ -141,7 +141,7 @@ public function getHistoryForScheduled(Request $request, int $id): Response private function getPager(QueryBuilder $query, Request $request): Pagerfanta { - $pager = new Pagerfanta(new DoctrineDbalAdapter($query, function ($queryBuilder) { + $pager = new Pagerfanta(new QueryAdapter($query, function ($queryBuilder) { return $queryBuilder->select('COUNT(DISTINCT id) AS total_results') ->resetQueryPart('orderBy') ->setMaxResults(1); diff --git a/src/Controller/JobController.php b/src/Controller/JobController.php index 6cf1041..07246e4 100644 --- a/src/Controller/JobController.php +++ b/src/Controller/JobController.php @@ -7,9 +7,9 @@ use CodeRhapsodie\DataflowBundle\Entity\Job; use CodeRhapsodie\EzDataflowBundle\Form\CreateOneshotType; use CodeRhapsodie\EzDataflowBundle\Gateway\JobGateway; -use eZ\Publish\Core\MVC\Symfony\Security\Authorization\Attribute; -use EzSystems\EzPlatformAdminUi\Notification\NotificationHandlerInterface; -use EzSystems\EzPlatformAdminUiBundle\Controller\Controller; +use Ibexa\Contracts\AdminUi\Controller\Controller; +use Ibexa\Contracts\AdminUi\Notification\NotificationHandlerInterface; +use Ibexa\Core\MVC\Symfony\Security\Authorization\Attribute; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; @@ -22,11 +22,11 @@ */ class JobController extends Controller { - /** @var JobGateway */ + /** @var \CodeRhapsodie\EzDataflowBundle\Gateway\JobGateway */ private $jobGateway; - /** @var NotificationHandlerInterface */ + /** @var \Ibexa\Contracts\AdminUi\Notification\NotificationHandlerInterface */ private $notificationHandler; - /** @var Symfony\Component\Translation\TranslatorInterface|Symfony\Contracts\Translation\TranslatorInterface */ + /** @var \Symfony\Contracts\Translation\TranslatorInterface */ private $translator; public function __construct( @@ -46,7 +46,7 @@ public function displayDetails(int $id): Response { $this->denyAccessUnlessGranted(new Attribute('ezdataflow', 'view')); - return $this->render('@ezdesign/ezdataflow/Item/details.html.twig', [ + return $this->render('@ibexadesign/ezdataflow/Item/details.html.twig', [ 'item' => $this->jobGateway->find($id), ]); } @@ -62,7 +62,7 @@ public function displayLog(int $id): Response return preg_replace('~#\d+~', "\n$0", $line); }, $item->getExceptions()); - return $this->render('@ezdesign/ezdataflow/Item/log.html.twig', [ + return $this->render('@ibexadesign/ezdataflow/Item/log.html.twig', [ 'log' => $log, ]); } @@ -78,7 +78,7 @@ public function create(Request $request): Response $form = $this->createForm(CreateOneshotType::class, $newOneshot); $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { - /** @var Job $newOneshot */ + /** @var \CodeRhapsodie\DataflowBundle\Entity\Job $newOneshot */ $newOneshot = $form->getData(); $newOneshot->setStatus(Job::STATUS_PENDING); @@ -97,7 +97,7 @@ public function create(Request $request): Response } return new JsonResponse([ - 'form' => $this->renderView('@ezdesign/ezdataflow/parts/schedule_form.html.twig', [ + 'form' => $this->renderView('@ibexadesign/ezdataflow/parts/form_modal.html.twig', [ 'form' => $form->createView(), 'type_action' => 'new', 'mode' => 'oneshot', diff --git a/src/Controller/ScheduledDataflowController.php b/src/Controller/ScheduledDataflowController.php index 959df38..2d52359 100644 --- a/src/Controller/ScheduledDataflowController.php +++ b/src/Controller/ScheduledDataflowController.php @@ -7,11 +7,10 @@ use CodeRhapsodie\DataflowBundle\Entity\ScheduledDataflow; use CodeRhapsodie\EzDataflowBundle\Form\CreateScheduledType; use CodeRhapsodie\EzDataflowBundle\Form\UpdateScheduledType; -use CodeRhapsodie\EzDataflowBundle\Gateway\JobGateway; use CodeRhapsodie\EzDataflowBundle\Gateway\ScheduledDataflowGateway; -use eZ\Publish\Core\MVC\Symfony\Security\Authorization\Attribute; -use EzSystems\EzPlatformAdminUi\Notification\NotificationHandlerInterface; -use EzSystems\EzPlatformAdminUiBundle\Controller\Controller; +use Ibexa\Contracts\AdminUi\Controller\Controller; +use Ibexa\Contracts\AdminUi\Notification\NotificationHandlerInterface; +use Ibexa\Core\MVC\Symfony\Security\Authorization\Attribute; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; @@ -23,22 +22,18 @@ */ class ScheduledDataflowController extends Controller { - /** @var JobGateway */ - private $jobGateway; - /** @var NotificationHandlerInterface */ + /** @var \Ibexa\Contracts\AdminUi\Notification\NotificationHandlerInterface */ private $notificationHandler; - /** @var ScheduledDataflowGateway */ + /** @var \CodeRhapsodie\EzDataflowBundle\Gateway\ScheduledDataflowGateway */ private $scheduledDataflowGateway; - /** @var TranslatorInterface */ + /** @var \Symfony\Contracts\Translation\TranslatorInterface */ private $translator; public function __construct( - JobGateway $jobGateway, NotificationHandlerInterface $notificationHandler, ScheduledDataflowGateway $scheduledDataflowGateway, TranslatorInterface $translator ) { - $this->jobGateway = $jobGateway; $this->notificationHandler = $notificationHandler; $this->scheduledDataflowGateway = $scheduledDataflowGateway; $this->translator = $translator; @@ -56,7 +51,7 @@ public function create(Request $request): Response $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { - /** @var ScheduledDataflow $newWorkflow */ + /** @var \CodeRhapsodie\DataflowBundle\Entity\ScheduledDataflow $newWorkflow */ $newWorkflow = $form->getData(); try { $this->scheduledDataflowGateway->save($newWorkflow); @@ -70,7 +65,7 @@ public function create(Request $request): Response } return new JsonResponse([ - 'form' => $this->renderView('@ezdesign/ezdataflow/parts/schedule_form.html.twig', [ + 'form' => $this->renderView('@ibexadesign/ezdataflow/parts/form_modal.html.twig', [ 'form' => $form->createView(), 'type_action' => 'new', ]), @@ -87,14 +82,12 @@ public function delete(int $id): Response try { $this->scheduledDataflowGateway->delete($id); $this->notificationHandler->success($this->translator->trans('coderhapsodie.ezdataflow.workflow.delete.success')); - - return new JsonResponse(['code' => 200]); } catch (\Exception $e) { $this->notificationHandler->error($this->translator->trans('coderhapsodie.ezdataflow.workflow.delete.error', ['message' => $e->getMessage()])); - - return new JsonResponse(['code' => $e->getCode()]); } + + return $this->redirectToRoute('coderhapsodie.ezdataflow.main'); } /** @@ -108,7 +101,7 @@ public function edit(Request $request, int $id): Response $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { - /** @var ScheduledDataflow $editDataflow */ + /** @var \CodeRhapsodie\DataflowBundle\Entity\ScheduledDataflow $editDataflow */ $editDataflow = $form->getData(); try { @@ -123,7 +116,7 @@ public function edit(Request $request, int $id): Response } return new JsonResponse([ - 'form' => $this->renderView('@ezdesign/ezdataflow/parts/schedule_form.html.twig', [ + 'form' => $this->renderView('@ibexadesign/ezdataflow/parts/form_modal.html.twig', [ 'form' => $form->createView(), 'type_action' => 'edit', ]), @@ -145,7 +138,7 @@ public function enableDataflow(int $id): Response private function changeDataflowStatus(int $id, bool $status) { try { - /** @var ScheduledDataflow $workflow */ + /** @var \CodeRhapsodie\DataflowBundle\Entity\ScheduledDataflow $workflow */ $workflow = $this->scheduledDataflowGateway->find($id); $workflow->setEnabled($status); $this->scheduledDataflowGateway->save($workflow); diff --git a/src/Core/Content/ContentCreator.php b/src/Core/Content/ContentCreator.php index fcd74de..9fb41ae 100644 --- a/src/Core/Content/ContentCreator.php +++ b/src/Core/Content/ContentCreator.php @@ -7,23 +7,23 @@ use CodeRhapsodie\EzDataflowBundle\Core\Field\ContentStructFieldFillerInterface; use CodeRhapsodie\EzDataflowBundle\Matcher\LocationMatcherInterface; use CodeRhapsodie\EzDataflowBundle\Model\ContentCreateStructure; -use eZ\Publish\API\Repository\ContentService; -use eZ\Publish\API\Repository\ContentTypeService; -use eZ\Publish\API\Repository\Values\Content\Content; -use eZ\Publish\API\Repository\Values\Content\LocationCreateStruct; +use Ibexa\Contracts\Core\Repository\ContentService; +use Ibexa\Contracts\Core\Repository\ContentTypeService; +use Ibexa\Contracts\Core\Repository\Values\Content\Content; +use Ibexa\Contracts\Core\Repository\Values\Content\LocationCreateStruct; class ContentCreator implements ContentCreatorInterface { - /** @var ContentService */ + /** @var \Ibexa\Contracts\Core\Repository\ContentService */ private $contentService; - /** @var ContentTypeService */ + /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */ private $contentTypeService; - /** @var ContentStructFieldFillerInterface */ + /** @var \CodeRhapsodie\EzDataflowBundle\Core\Field\ContentStructFieldFillerInterface */ private $filler; - /** @var LocationMatcherInterface */ + /** @var \CodeRhapsodie\EzDataflowBundle\Matcher\LocationMatcherInterface */ private $matcher; public function __construct(ContentService $contentService, ContentTypeService $contentTypeService, ContentStructFieldFillerInterface $filler, LocationMatcherInterface $matcher) @@ -35,12 +35,12 @@ public function __construct(ContentService $contentService, ContentTypeService $ } /** - * @throws \eZ\Publish\API\Repository\Exceptions\BadStateException - * @throws \eZ\Publish\API\Repository\Exceptions\ContentFieldValidationException - * @throws \eZ\Publish\API\Repository\Exceptions\ContentValidationException - * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException - * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\ContentFieldValidationException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\ContentValidationException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException */ public function createFromStructure(ContentCreateStructure $structure): Content { @@ -54,7 +54,7 @@ public function createFromStructure(ContentCreateStructure $structure): Content } /** - * @return LocationCreateStruct[] + * @return \Ibexa\Contracts\Core\Repository\Values\Content\LocationCreateStruct[] */ private function getLocationCreateStructs(array $locations): array { diff --git a/src/Core/Content/ContentCreatorInterface.php b/src/Core/Content/ContentCreatorInterface.php index 1696495..5a54d7d 100644 --- a/src/Core/Content/ContentCreatorInterface.php +++ b/src/Core/Content/ContentCreatorInterface.php @@ -5,7 +5,7 @@ namespace CodeRhapsodie\EzDataflowBundle\Core\Content; use CodeRhapsodie\EzDataflowBundle\Model\ContentCreateStructure; -use eZ\Publish\API\Repository\Values\Content\Content; +use Ibexa\Contracts\Core\Repository\Values\Content\Content; interface ContentCreatorInterface { diff --git a/src/Core/Content/ContentUpdater.php b/src/Core/Content/ContentUpdater.php index 860f576..fa332a0 100644 --- a/src/Core/Content/ContentUpdater.php +++ b/src/Core/Content/ContentUpdater.php @@ -7,19 +7,19 @@ use CodeRhapsodie\EzDataflowBundle\Core\Field\ContentStructFieldFillerInterface; use CodeRhapsodie\EzDataflowBundle\Exception\NoMatchFoundException; use CodeRhapsodie\EzDataflowBundle\Model\ContentUpdateStructure; -use eZ\Publish\API\Repository\ContentService; -use eZ\Publish\API\Repository\ContentTypeService; -use eZ\Publish\API\Repository\Values\Content\Content; +use Ibexa\Contracts\Core\Repository\ContentService; +use Ibexa\Contracts\Core\Repository\ContentTypeService; +use Ibexa\Contracts\Core\Repository\Values\Content\Content; class ContentUpdater implements ContentUpdaterInterface { - /** @var ContentService */ + /** @var \Ibexa\Contracts\Core\Repository\ContentService */ private $contentService; - /** @var ContentTypeService */ + /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */ private $contentTypeService; - /** @var ContentStructFieldFillerInterface */ + /** @var \CodeRhapsodie\EzDataflowBundle\Core\Field\ContentStructFieldFillerInterface */ private $filler; public function __construct(ContentService $contentService, ContentTypeService $contentTypeService, ContentStructFieldFillerInterface $filler) @@ -30,13 +30,13 @@ public function __construct(ContentService $contentService, ContentTypeService $ } /** - * @throws NoMatchFoundException - * @throws \eZ\Publish\API\Repository\Exceptions\BadStateException - * @throws \eZ\Publish\API\Repository\Exceptions\ContentFieldValidationException - * @throws \eZ\Publish\API\Repository\Exceptions\ContentValidationException - * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException - * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException + * @throws \CodeRhapsodie\EzDataflowBundle\Exception\NoMatchFoundException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\ContentFieldValidationException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\ContentValidationException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException */ public function updateFromStructure(ContentUpdateStructure $structure): Content { diff --git a/src/Core/Content/ContentUpdaterInterface.php b/src/Core/Content/ContentUpdaterInterface.php index a12fc2f..e00f491 100644 --- a/src/Core/Content/ContentUpdaterInterface.php +++ b/src/Core/Content/ContentUpdaterInterface.php @@ -5,7 +5,7 @@ namespace CodeRhapsodie\EzDataflowBundle\Core\Content; use CodeRhapsodie\EzDataflowBundle\Model\ContentUpdateStructure; -use eZ\Publish\API\Repository\Values\Content\Content; +use Ibexa\Contracts\Core\Repository\Values\Content\Content; interface ContentUpdaterInterface { diff --git a/src/Core/Field/ContentStructFieldFiller.php b/src/Core/Field/ContentStructFieldFiller.php index 3847dc8..60da48c 100644 --- a/src/Core/Field/ContentStructFieldFiller.php +++ b/src/Core/Field/ContentStructFieldFiller.php @@ -6,9 +6,9 @@ use CodeRhapsodie\EzDataflowBundle\Exception\UnknownFieldException; use CodeRhapsodie\EzDataflowBundle\Exception\UnsupportedFieldTypeException; -use eZ\Publish\API\Repository\Values\Content\ContentStruct; -use eZ\Publish\API\Repository\Values\ContentType\ContentType; -use eZ\Publish\Core\FieldType\Value; +use Ibexa\Contracts\Core\FieldType\Value; +use Ibexa\Contracts\Core\Repository\Values\Content\ContentStruct; +use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType; class ContentStructFieldFiller implements ContentStructFieldFillerInterface { @@ -26,8 +26,8 @@ public function __construct(iterable $fieldValueCreators) /** * {@inheritdoc} * - * @throws UnknownFieldException - * @throws UnsupportedFieldTypeException + * @throws \CodeRhapsodie\EzDataflowBundle\Exception\UnknownFieldException + * @throws \CodeRhapsodie\EzDataflowBundle\Exception\UnsupportedFieldTypeException */ public function fillFields(ContentType $contentType, ContentStruct $contentStruct, array $fieldHashes): void { @@ -47,7 +47,7 @@ public function fillFields(ContentType $contentType, ContentStruct $contentStruc /** * @param mixed $hash * - * @throws UnsupportedFieldTypeException + * @throws \CodeRhapsodie\EzDataflowBundle\Exception\UnsupportedFieldTypeException */ private function createFieldValue(string $fieldTypeIdentifier, $hash): Value { diff --git a/src/Core/Field/ContentStructFieldFillerInterface.php b/src/Core/Field/ContentStructFieldFillerInterface.php index 6cae13d..a366086 100644 --- a/src/Core/Field/ContentStructFieldFillerInterface.php +++ b/src/Core/Field/ContentStructFieldFillerInterface.php @@ -4,8 +4,8 @@ namespace CodeRhapsodie\EzDataflowBundle\Core\Field; -use eZ\Publish\API\Repository\Values\Content\ContentStruct; -use eZ\Publish\API\Repository\Values\ContentType\ContentType; +use Ibexa\Contracts\Core\Repository\Values\Content\ContentStruct; +use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType; interface ContentStructFieldFillerInterface { diff --git a/src/Core/Field/DefaultFieldValueCreator.php b/src/Core/Field/DefaultFieldValueCreator.php index 4401885..5f55618 100644 --- a/src/Core/Field/DefaultFieldValueCreator.php +++ b/src/Core/Field/DefaultFieldValueCreator.php @@ -4,12 +4,12 @@ namespace CodeRhapsodie\EzDataflowBundle\Core\Field; -use eZ\Publish\API\Repository\FieldTypeService; -use eZ\Publish\Core\FieldType\Value; +use Ibexa\Contracts\Core\FieldType\Value; +use Ibexa\Contracts\Core\Repository\FieldTypeService; class DefaultFieldValueCreator implements FieldValueCreatorInterface { - /** @var FieldTypeService */ + /** @var \Ibexa\Contracts\Core\Repository\FieldTypeService */ private $fieldTypeService; public function __construct(FieldTypeService $fieldTypeService) diff --git a/src/Core/Field/FieldValueCreatorInterface.php b/src/Core/Field/FieldValueCreatorInterface.php index f1788b8..6dc8843 100644 --- a/src/Core/Field/FieldValueCreatorInterface.php +++ b/src/Core/Field/FieldValueCreatorInterface.php @@ -4,7 +4,7 @@ namespace CodeRhapsodie\EzDataflowBundle\Core\Field; -use eZ\Publish\Core\FieldType\Value; +use Ibexa\Contracts\Core\FieldType\Value; interface FieldValueCreatorInterface { diff --git a/src/Core/FieldComparator/AbstractFieldComparator.php b/src/Core/FieldComparator/AbstractFieldComparator.php index 2d3042e..a3118a5 100644 --- a/src/Core/FieldComparator/AbstractFieldComparator.php +++ b/src/Core/FieldComparator/AbstractFieldComparator.php @@ -4,13 +4,13 @@ namespace CodeRhapsodie\EzDataflowBundle\Core\FieldComparator; -use eZ\Publish\API\Repository\FieldTypeService; -use eZ\Publish\API\Repository\Values\Content\Field; -use eZ\Publish\Core\FieldType\Value; +use Ibexa\Contracts\Core\FieldType\Value; +use Ibexa\Contracts\Core\Repository\FieldTypeService; +use Ibexa\Contracts\Core\Repository\Values\Content\Field; abstract class AbstractFieldComparator implements FieldComparatorInterface { - /** @var FieldTypeService */ + /** @var \Ibexa\Contracts\Core\Repository\FieldTypeService */ private $fieldTypeService; public function __construct(FieldTypeService $fieldTypeService) diff --git a/src/Core/FieldComparator/DelegatorFieldComparator.php b/src/Core/FieldComparator/DelegatorFieldComparator.php index 57c0e82..e3eb809 100644 --- a/src/Core/FieldComparator/DelegatorFieldComparator.php +++ b/src/Core/FieldComparator/DelegatorFieldComparator.php @@ -4,7 +4,7 @@ namespace CodeRhapsodie\EzDataflowBundle\Core\FieldComparator; -use eZ\Publish\API\Repository\Values\Content\Field; +use Ibexa\Contracts\Core\Repository\Values\Content\Field; class DelegatorFieldComparator implements FieldComparatorInterface { diff --git a/src/Core/FieldComparator/FieldComparatorInterface.php b/src/Core/FieldComparator/FieldComparatorInterface.php index 2db0055..e985f2b 100644 --- a/src/Core/FieldComparator/FieldComparatorInterface.php +++ b/src/Core/FieldComparator/FieldComparatorInterface.php @@ -4,7 +4,7 @@ namespace CodeRhapsodie\EzDataflowBundle\Core\FieldComparator; -use eZ\Publish\API\Repository\Values\Content\Field; +use Ibexa\Contracts\Core\Repository\Values\Content\Field; interface FieldComparatorInterface { diff --git a/src/Core/FieldComparator/MapLocationFieldComparator.php b/src/Core/FieldComparator/MapLocationFieldComparator.php index d8ecac3..5848f50 100644 --- a/src/Core/FieldComparator/MapLocationFieldComparator.php +++ b/src/Core/FieldComparator/MapLocationFieldComparator.php @@ -4,7 +4,7 @@ namespace CodeRhapsodie\EzDataflowBundle\Core\FieldComparator; -use eZ\Publish\Core\FieldType\Value; +use Ibexa\Contracts\Core\FieldType\Value; class MapLocationFieldComparator extends AbstractFieldComparator { diff --git a/src/Core/FieldComparator/MatrixFieldComparator.php b/src/Core/FieldComparator/MatrixFieldComparator.php index 5a276f9..0e222ba 100644 --- a/src/Core/FieldComparator/MatrixFieldComparator.php +++ b/src/Core/FieldComparator/MatrixFieldComparator.php @@ -4,7 +4,7 @@ namespace CodeRhapsodie\EzDataflowBundle\Core\FieldComparator; -use eZ\Publish\Core\FieldType\Value; +use Ibexa\Contracts\Core\FieldType\Value; class MatrixFieldComparator extends AbstractFieldComparator { diff --git a/src/Core/FieldComparator/NovaSEOMetasFieldComparator.php b/src/Core/FieldComparator/NovaSEOMetasFieldComparator.php index c0ed844..59c4c2c 100644 --- a/src/Core/FieldComparator/NovaSEOMetasFieldComparator.php +++ b/src/Core/FieldComparator/NovaSEOMetasFieldComparator.php @@ -4,7 +4,7 @@ namespace CodeRhapsodie\EzDataflowBundle\Core\FieldComparator; -use eZ\Publish\Core\FieldType\Value; +use Ibexa\Contracts\Core\FieldType\Value; class NovaSEOMetasFieldComparator extends AbstractFieldComparator { diff --git a/src/Core/FieldComparator/SimpleFieldComparator.php b/src/Core/FieldComparator/SimpleFieldComparator.php index cddf6a7..82a753e 100644 --- a/src/Core/FieldComparator/SimpleFieldComparator.php +++ b/src/Core/FieldComparator/SimpleFieldComparator.php @@ -4,7 +4,7 @@ namespace CodeRhapsodie\EzDataflowBundle\Core\FieldComparator; -use eZ\Publish\Core\FieldType\Value; +use Ibexa\Contracts\Core\FieldType\Value; class SimpleFieldComparator extends AbstractFieldComparator { diff --git a/src/Core/FieldComparator/UrlFieldComparator.php b/src/Core/FieldComparator/UrlFieldComparator.php index c6b492e..aa0443c 100644 --- a/src/Core/FieldComparator/UrlFieldComparator.php +++ b/src/Core/FieldComparator/UrlFieldComparator.php @@ -4,7 +4,7 @@ namespace CodeRhapsodie\EzDataflowBundle\Core\FieldComparator; -use eZ\Publish\Core\FieldType\Value; +use Ibexa\Contracts\Core\FieldType\Value; class UrlFieldComparator extends AbstractFieldComparator { diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php index 4ad1f03..7bbdfd8 100644 --- a/src/DependencyInjection/Configuration.php +++ b/src/DependencyInjection/Configuration.php @@ -16,13 +16,7 @@ public function getConfigTreeBuilder() { $treeBuilder = new TreeBuilder('code_rhapsodie_ez_dataflow'); - if (method_exists($treeBuilder, 'getRootNode')) { - $rootNode = $treeBuilder->getRootNode(); - } else { - // BC for symfony/config < 4.2 - $rootNode = $treeBuilder->root('code_rhapsodie_ez_dataflow'); - } - + $rootNode = $treeBuilder->getRootNode(); $rootNode ->children() ->scalarNode('admin_login_or_id') diff --git a/src/EventSubscriber/MenuSubscriber.php b/src/EventSubscriber/MenuSubscriber.php index 05c730d..4c36e73 100644 --- a/src/EventSubscriber/MenuSubscriber.php +++ b/src/EventSubscriber/MenuSubscriber.php @@ -4,9 +4,8 @@ namespace CodeRhapsodie\EzDataflowBundle\EventSubscriber; -use EzSystems\EzPlatformAdminUi\Menu\Event\ConfigureMenuEvent; -use EzSystems\EzPlatformAdminUi\Menu\MainMenuBuilder; -use Knp\Menu\ItemInterface; +use Ibexa\AdminUi\Menu\Event\ConfigureMenuEvent; +use Ibexa\AdminUi\Menu\MainMenuBuilder; use Symfony\Component\EventDispatcher\EventSubscriberInterface; class MenuSubscriber implements EventSubscriberInterface @@ -21,7 +20,7 @@ public static function getSubscribedEvents() public function onConfigureMenu(ConfigureMenuEvent $event) { - /** @var ItemInterface $menu */ + /** @var \Knp\Menu\ItemInterface $menu */ $menu = $event->getMenu(); if (!isset($menu[MainMenuBuilder::ITEM_ADMIN])) { return; diff --git a/src/Factory/ContentStructureFactory.php b/src/Factory/ContentStructureFactory.php index c0e5a85..22a2e10 100644 --- a/src/Factory/ContentStructureFactory.php +++ b/src/Factory/ContentStructureFactory.php @@ -5,15 +5,14 @@ namespace CodeRhapsodie\EzDataflowBundle\Factory; use CodeRhapsodie\EzDataflowBundle\Model\ContentCreateStructure; -use CodeRhapsodie\EzDataflowBundle\Model\ContentStructure; use CodeRhapsodie\EzDataflowBundle\Model\ContentUpdateStructure; -use eZ\Publish\API\Repository\ContentService; -use eZ\Publish\API\Repository\Exceptions\NotFoundException; +use Ibexa\Contracts\Core\Repository\ContentService; +use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; final class ContentStructureFactory implements ContentStructureFactoryInterface { /** - * @var ContentService + * @var \Ibexa\Contracts\Core\Repository\ContentService */ private $contentService; @@ -29,10 +28,10 @@ public function __construct(ContentService $contentService) * @param mixed $parentLocations * @param int $mode One of the constant ContentStructureFactoryInterface::MODE_* * - * @return false|ContentStructure + * @return false|\CodeRhapsodie\EzDataflowBundle\Model\ContentStructure * * @throws \CodeRhapsodie\EzDataflowBundle\Exception\InvalidArgumentTypeException - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException */ public function transform(array $data, string $remoteId, string $language, string $contentType, $parentLocations, int $mode = ContentStructureFactoryInterface::MODE_INSERT_OR_UPDATE) { @@ -47,7 +46,7 @@ public function transform(array $data, string $remoteId, string $language, strin // The content doesn't exist yet, so it will be created. } - if ($mode === static::MODE_UPDATE_ONLY) { + if (self::MODE_UPDATE_ONLY === $mode) { return false; } diff --git a/src/Filter/NotModifiedContentFilter.php b/src/Filter/NotModifiedContentFilter.php index 53575d8..2a0255d 100644 --- a/src/Filter/NotModifiedContentFilter.php +++ b/src/Filter/NotModifiedContentFilter.php @@ -6,7 +6,7 @@ use CodeRhapsodie\EzDataflowBundle\Core\FieldComparator\FieldComparatorInterface; use CodeRhapsodie\EzDataflowBundle\Model\ContentUpdateStructure; -use eZ\Publish\API\Repository\ContentService; +use Ibexa\Contracts\Core\Repository\ContentService; use Psr\Log\LoggerAwareTrait; /** @@ -16,10 +16,10 @@ class NotModifiedContentFilter { use LoggerAwareTrait; - /** @var ContentService */ + /** @var \Ibexa\Contracts\Core\Repository\ContentService */ private $contentService; - /** @var FieldComparatorInterface */ + /** @var \CodeRhapsodie\EzDataflowBundle\Core\FieldComparator\FieldComparatorInterface */ private $comparator; public function __construct(ContentService $contentService, FieldComparatorInterface $comparator) diff --git a/src/Form/DataflowTypeChoiceType.php b/src/Form/DataflowTypeChoiceType.php index b19b07e..26ad964 100644 --- a/src/Form/DataflowTypeChoiceType.php +++ b/src/Form/DataflowTypeChoiceType.php @@ -11,7 +11,7 @@ class DataflowTypeChoiceType extends AbstractType { - /** @var DataflowTypeRegistryInterface */ + /** @var \CodeRhapsodie\DataflowBundle\Registry\DataflowTypeRegistryInterface */ private $registry; public function __construct(DataflowTypeRegistryInterface $registry) diff --git a/src/Form/UserTimezoneAwareDateTimeTransformer.php b/src/Form/UserTimezoneAwareDateTimeTransformer.php index c17d03b..39a2a04 100644 --- a/src/Form/UserTimezoneAwareDateTimeTransformer.php +++ b/src/Form/UserTimezoneAwareDateTimeTransformer.php @@ -4,13 +4,13 @@ namespace CodeRhapsodie\EzDataflowBundle\Form; -use eZ\Publish\API\Repository\Exceptions\NotFoundException; -use eZ\Publish\API\Repository\UserPreferenceService; +use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; +use Ibexa\Contracts\Core\Repository\UserPreferenceService; use Symfony\Component\Form\DataTransformerInterface; class UserTimezoneAwareDateTimeTransformer implements DataTransformerInterface { - /** @var UserPreferenceService */ + /** @var \Ibexa\Contracts\Core\Repository\UserPreferenceService */ private $userPreferenceService; public function __construct(UserPreferenceService $userPreferenceService) diff --git a/src/Form/UserTimezoneAwareDateTimeType.php b/src/Form/UserTimezoneAwareDateTimeType.php index fe0618e..f93fc0f 100644 --- a/src/Form/UserTimezoneAwareDateTimeType.php +++ b/src/Form/UserTimezoneAwareDateTimeType.php @@ -4,14 +4,14 @@ namespace CodeRhapsodie\EzDataflowBundle\Form; -use eZ\Publish\API\Repository\UserPreferenceService; +use Ibexa\Contracts\Core\Repository\UserPreferenceService; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\DateTimeType; use Symfony\Component\Form\FormBuilderInterface; class UserTimezoneAwareDateTimeType extends AbstractType { - /** @var UserPreferenceService */ + /** @var \Ibexa\Contracts\Core\Repository\UserPreferenceService */ private $userPreferenceService; public function __construct(UserPreferenceService $userPreferenceService) diff --git a/src/Gateway/JobGateway.php b/src/Gateway/JobGateway.php index 53e1b0a..4a2e31b 100644 --- a/src/Gateway/JobGateway.php +++ b/src/Gateway/JobGateway.php @@ -13,7 +13,7 @@ final class JobGateway public const FILTER_NONE = 0; public const FILTER_NON_EMPTY = 1; - /** @var JobRepository */ + /** @var \CodeRhapsodie\DataflowBundle\Repository\JobRepository */ private $jobRepository; public function __construct(JobRepository $jobRepository) diff --git a/src/Gateway/ScheduledDataflowGateway.php b/src/Gateway/ScheduledDataflowGateway.php index 885689b..c4ec80f 100644 --- a/src/Gateway/ScheduledDataflowGateway.php +++ b/src/Gateway/ScheduledDataflowGateway.php @@ -10,7 +10,7 @@ final class ScheduledDataflowGateway { - /** @var ScheduledDataflowRepository */ + /** @var \CodeRhapsodie\DataflowBundle\Repository\ScheduledDataflowRepository */ private $scheduledDataflowRepository; public function __construct(ScheduledDataflowRepository $scheduledDataflowRepository) diff --git a/src/Matcher/LocationMatcher.php b/src/Matcher/LocationMatcher.php index d1ff65a..bd3f615 100644 --- a/src/Matcher/LocationMatcher.php +++ b/src/Matcher/LocationMatcher.php @@ -5,13 +5,13 @@ namespace CodeRhapsodie\EzDataflowBundle\Matcher; use CodeRhapsodie\EzDataflowBundle\Exception\NoMatchFoundException; -use eZ\Publish\API\Repository\Exceptions\NotFoundException; -use eZ\Publish\API\Repository\LocationService; -use eZ\Publish\API\Repository\Values\Content\Location; +use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; +use Ibexa\Contracts\Core\Repository\LocationService; +use Ibexa\Contracts\Core\Repository\Values\Content\Location; class LocationMatcher implements LocationMatcherInterface { - /** @var LocationService */ + /** @var \Ibexa\Contracts\Core\Repository\LocationService */ private $locationService; public function __construct(LocationService $locationService) @@ -22,8 +22,8 @@ public function __construct(LocationService $locationService) /** * @param mixed $valueToMatch * - * @throws NoMatchFoundException - * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException + * @throws \CodeRhapsodie\EzDataflowBundle\Exception\NoMatchFoundException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException */ public function matchLocation($valueToMatch): Location { diff --git a/src/Matcher/LocationMatcherInterface.php b/src/Matcher/LocationMatcherInterface.php index df559d1..41dafee 100644 --- a/src/Matcher/LocationMatcherInterface.php +++ b/src/Matcher/LocationMatcherInterface.php @@ -4,7 +4,7 @@ namespace CodeRhapsodie\EzDataflowBundle\Matcher; -use eZ\Publish\API\Repository\Values\Content\Location; +use Ibexa\Contracts\Core\Repository\Values\Content\Location; interface LocationMatcherInterface { diff --git a/src/Model/ContentCreateStructure.php b/src/Model/ContentCreateStructure.php index bdd33d0..c3f88e2 100644 --- a/src/Model/ContentCreateStructure.php +++ b/src/Model/ContentCreateStructure.php @@ -5,8 +5,8 @@ namespace CodeRhapsodie\EzDataflowBundle\Model; use CodeRhapsodie\EzDataflowBundle\Exception\InvalidArgumentTypeException; -use eZ\Publish\API\Repository\Values\Content\Location; -use eZ\Publish\API\Repository\Values\Content\LocationCreateStruct; +use Ibexa\Contracts\Core\Repository\Values\Content\Location; +use Ibexa\Contracts\Core\Repository\Values\Content\LocationCreateStruct; class ContentCreateStructure extends ContentStructure { @@ -28,7 +28,7 @@ class ContentCreateStructure extends ContentStructure *
  • a LocationCreateStruct object
  • * * - * @throws InvalidArgumentTypeException + * @throws \CodeRhapsodie\EzDataflowBundle\Exception\InvalidArgumentTypeException */ public function __construct(string $contentTypeIdentifier, string $languageCode, array $locations, array $fields, ?string $remoteId = null) { @@ -50,7 +50,7 @@ public function getLocations(): array } /** - * @throws InvalidArgumentTypeException + * @throws \CodeRhapsodie\EzDataflowBundle\Exception\InvalidArgumentTypeException */ private function setLocations(array $locations) { diff --git a/src/Resources/config/services.yaml b/src/Resources/config/services.yaml index eb7e6f6..888bf00 100644 --- a/src/Resources/config/services.yaml +++ b/src/Resources/config/services.yaml @@ -5,7 +5,7 @@ services: _defaults: public: false - coderhapsodie.dataflow.connection: "@ezpublish.persistence.connection" + coderhapsodie.dataflow.connection: "@ibexa.persistence.connection" CodeRhapsodie\EzDataflowBundle\Controller\DashboardController: public: true @@ -23,8 +23,7 @@ services: tags: - { name: controller.service_arguments } arguments: - $jobGateway: '@CodeRhapsodie\EzDataflowBundle\Gateway\JobGateway' - $notificationHandler: '@EzSystems\EzPlatformAdminUi\Notification\NotificationHandlerInterface' + $notificationHandler: '@Ibexa\Contracts\AdminUi\Notification\NotificationHandlerInterface' $scheduledDataflowGateway: '@CodeRhapsodie\EzDataflowBundle\Gateway\ScheduledDataflowGateway' $translator: '@translator' calls: @@ -37,7 +36,7 @@ services: - { name: controller.service_arguments } arguments: $jobGateway: '@CodeRhapsodie\EzDataflowBundle\Gateway\JobGateway' - $notificationHandler: '@EzSystems\EzPlatformAdminUi\Notification\NotificationHandlerInterface' + $notificationHandler: '@Ibexa\Contracts\AdminUi\Notification\NotificationHandlerInterface' $translator: '@translator' calls: - [ 'setContainer', [ '@service_container' ] ] @@ -58,23 +57,23 @@ services: CodeRhapsodie\EzDataflowBundle\UserSwitcher\UserSwitcherInterface: '@CodeRhapsodie\EzDataflowBundle\UserSwitcher\UserSwitcher' CodeRhapsodie\EzDataflowBundle\UserSwitcher\UserSwitcher: arguments: - $permissionResolver: '@eZ\Publish\API\Repository\PermissionResolver' - $userService: '@eZ\Publish\API\Repository\UserService' + $permissionResolver: '@Ibexa\Contracts\Core\Repository\PermissionResolver' + $userService: '@Ibexa\Contracts\Core\Repository\UserService' $adminLoginOrId: '%coderhapsodie.ezdataflow.admin_login_or_id%' CodeRhapsodie\EzDataflowBundle\Core\Content\ContentCreatorInterface: '@CodeRhapsodie\EzDataflowBundle\Core\Content\ContentCreator' CodeRhapsodie\EzDataflowBundle\Core\Content\ContentCreator: arguments: - $contentService: '@eZ\Publish\API\Repository\ContentService' - $contentTypeService: '@eZ\Publish\API\Repository\ContentTypeService' + $contentService: '@Ibexa\Contracts\Core\Repository\ContentService' + $contentTypeService: '@Ibexa\Contracts\Core\Repository\ContentTypeService' $filler: '@CodeRhapsodie\EzDataflowBundle\Core\Field\ContentStructFieldFillerInterface' $matcher: '@CodeRhapsodie\EzDataflowBundle\Matcher\LocationMatcherInterface' CodeRhapsodie\EzDataflowBundle\Core\Content\ContentUpdaterInterface: '@CodeRhapsodie\EzDataflowBundle\Core\Content\ContentUpdater' CodeRhapsodie\EzDataflowBundle\Core\Content\ContentUpdater: arguments: - $contentService: '@eZ\Publish\API\Repository\ContentService' - $contentTypeService: '@eZ\Publish\API\Repository\ContentTypeService' + $contentService: '@Ibexa\Contracts\Core\Repository\ContentService' + $contentTypeService: '@Ibexa\Contracts\Core\Repository\ContentTypeService' $filler: '@CodeRhapsodie\EzDataflowBundle\Core\Field\ContentStructFieldFillerInterface' CodeRhapsodie\EzDataflowBundle\Core\Field\ContentStructFieldFillerInterface: '@CodeRhapsodie\EzDataflowBundle\Core\Field\ContentStructFieldFiller' @@ -85,11 +84,11 @@ services: CodeRhapsodie\EzDataflowBundle\Matcher\LocationMatcherInterface: '@CodeRhapsodie\EzDataflowBundle\Matcher\LocationMatcher' CodeRhapsodie\EzDataflowBundle\Matcher\LocationMatcher: arguments: - $locationService: '@eZ\Publish\API\Repository\LocationService' + $locationService: '@Ibexa\Contracts\Core\Repository\LocationService' CodeRhapsodie\EzDataflowBundle\Core\Field\DefaultFieldValueCreator: arguments: - $fieldTypeService: '@eZ\Publish\API\Repository\FieldTypeService' + $fieldTypeService: '@Ibexa\Contracts\Core\Repository\FieldTypeService' tags: - { name: 'coderhapsodie.ezdataflow.field_value_creator', priority: -1000 } @@ -100,7 +99,7 @@ services: CodeRhapsodie\EzDataflowBundle\Factory\ContentStructureFactory: arguments: - $contentService: '@eZ\Publish\API\Repository\ContentService' + $contentService: '@Ibexa\Contracts\Core\Repository\ContentService' CodeRhapsodie\EzDataflowBundle\Form\DataflowTypeChoiceType: arguments: @@ -118,7 +117,7 @@ services: CodeRhapsodie\EzDataflowBundle\Form\UserTimezoneAwareDateTimeType: arguments: - $userPreferenceService: '@eZ\Publish\API\Repository\UserPreferenceService' + $userPreferenceService: '@Ibexa\Contracts\Core\Repository\UserPreferenceService' tags: ['form.type'] CodeRhapsodie\EzDataflowBundle\Gateway\ScheduledDataflowGateway: @@ -130,33 +129,33 @@ services: $jobRepository: '@CodeRhapsodie\DataflowBundle\Repository\JobRepository' CodeRhapsodie\EzDataflowBundle\Tab\RepeatingTab: - parent: EzSystems\EzPlatformAdminUi\Tab\AbstractTab + parent: Ibexa\Contracts\AdminUi\Tab\AbstractTab public: false arguments: $httpKernelRuntime: '@twig.runtime.httpkernel' tags: - - {name: ezplatform.tab, group: coderhapsodie-ezdataflow} + - {name: ibexa.admin_ui.tab, group: coderhapsodie-ezdataflow} CodeRhapsodie\EzDataflowBundle\Tab\OneshotTab: - parent: EzSystems\EzPlatformAdminUi\Tab\AbstractTab + parent: Ibexa\Contracts\AdminUi\Tab\AbstractTab public: false arguments: $httpKernelRuntime: '@twig.runtime.httpkernel' tags: - - {name: ezplatform.tab, group: coderhapsodie-ezdataflow} + - {name: ibexa.admin_ui.tab, group: coderhapsodie-ezdataflow} CodeRhapsodie\EzDataflowBundle\Tab\HistoryTab: - parent: EzSystems\EzPlatformAdminUi\Tab\AbstractTab + parent: Ibexa\Contracts\AdminUi\Tab\AbstractTab public: false arguments: $httpKernelRuntime: '@twig.runtime.httpkernel' tags: - - {name: ezplatform.tab, group: coderhapsodie-ezdataflow} + - {name: ibexa.admin_ui.tab, group: coderhapsodie-ezdataflow} CodeRhapsodie\EzDataflowBundle\Filter\NotModifiedContentFilter: arguments: - $contentService: '@eZ\Publish\API\Repository\ContentService' + $contentService: '@Ibexa\Contracts\Core\Repository\ContentService' $comparator: '@CodeRhapsodie\EzDataflowBundle\Core\FieldComparator\FieldComparatorInterface' CodeRhapsodie\EzDataflowBundle\Core\FieldComparator\FieldComparatorInterface: '@CodeRhapsodie\EzDataflowBundle\Core\FieldComparator\DelegatorFieldComparator' @@ -164,16 +163,15 @@ services: CodeRhapsodie\EzDataflowBundle\Core\FieldComparator\AbstractFieldComparator: arguments: - $fieldTypeService: '@eZ\Publish\API\Repository\FieldTypeService' + $fieldTypeService: '@Ibexa\Contracts\Core\Repository\FieldTypeService' abstract: true _cr.admin_tabs.ezdataflow_group: - parent: EzSystems\EzPlatformAdminUi\Component\TabsComponent + parent: Ibexa\AdminUi\Component\TabsComponent autowire: true autoconfigure: false public: false arguments: - $template: '@@ezdesign/ezdataflow/parts/tab/ezdataflow.html.twig' $groupIdentifier: 'coderhapsodie-ezdataflow' tags: - - { name: ezplatform.admin_ui.component, group: 'coderhapsodie-ezdataflow' } + - { name: ibexa.admin_ui.component, group: 'coderhapsodie-ezdataflow' } diff --git a/src/Resources/translations/menu.en.yaml b/src/Resources/translations/menu.en.yaml new file mode 100644 index 0000000..c666e3a --- /dev/null +++ b/src/Resources/translations/menu.en.yaml @@ -0,0 +1 @@ +coderhapsodie.ezdataflow: eZ Dataflow diff --git a/src/Resources/translations/menu.fr.yaml b/src/Resources/translations/menu.fr.yaml new file mode 100644 index 0000000..c666e3a --- /dev/null +++ b/src/Resources/translations/menu.fr.yaml @@ -0,0 +1 @@ +coderhapsodie.ezdataflow: eZ Dataflow diff --git a/src/Resources/translations/messages.fr.yaml b/src/Resources/translations/messages.fr.yaml index e337007..532685f 100644 --- a/src/Resources/translations/messages.fr.yaml +++ b/src/Resources/translations/messages.fr.yaml @@ -21,10 +21,15 @@ coderhapsodie.ezdataflow.history.list.title: 'Liste des exécutions' coderhapsodie.ezdataflow.history.list.name: Nom coderhapsodie.ezdataflow.history.list.request: 'Demandé le' coderhapsodie.ezdataflow.history.list.count: 'Nombre d''objets' +coderhapsodie.ezdataflow.history.list.error_count: 'Nombre d''erreurs' coderhapsodie.ezdataflow.history.list.start: 'Commencé le' coderhapsodie.ezdataflow.history.list.end: 'Terminé le' coderhapsodie.ezdataflow.history.list.view: 'Voir le détail' coderhapsodie.ezdataflow.history.list.status: État +coderhapsodie.ezdataflow.history.filter.label: Filtrer les résultats +coderhapsodie.ezdataflow.history.filter.none: Tous les résultats +coderhapsodie.ezdataflow.history.filter.non_empty_only: Seulement non vides +coderhapsodie.ezdataflow.history.filter.with_error_only: Seulement avec erreurs coderhapsodie.ezdataflow.job.status.pending: 'En attente' coderhapsodie.ezdataflow.job.status.running: 'En cours' coderhapsodie.ezdataflow.job.status.complete: Terminé diff --git a/src/Resources/views/themes/admin/ezdataflow/Dashboard/history.html.twig b/src/Resources/views/themes/admin/ezdataflow/Dashboard/history.html.twig index c26bdf9..ad70e70 100644 --- a/src/Resources/views/themes/admin/ezdataflow/Dashboard/history.html.twig +++ b/src/Resources/views/themes/admin/ezdataflow/Dashboard/history.html.twig @@ -1,35 +1,60 @@ -

    {{ 'coderhapsodie.ezdataflow.history.title'|trans }}

    +{%- block content -%} + {% set choices = [ + { + 'value': 0, + 'label': 'coderhapsodie.ezdataflow.history.filter.none'|trans, + }, + { + 'value': 1, + 'label': 'coderhapsodie.ezdataflow.history.filter.non_empty_only'|trans, + }, + ] %} -
    -
    {{ 'coderhapsodie.ezdataflow.history.list.title'|trans }}
    -
    - - + {% for choice in choices %} + + {% endfor %} -
    -
    + {% endset %} -{% include '@ezdesign/ezdataflow/parts/tab/job_list.html.twig' with { - identifier: 'ezdataflow_history_results', - paginate_route: 'coderhapsodie.ezdataflow.history', - paginate_params: {'filter': filter} -} %} + {% set actions %} + {{ include('@ibexadesign/ui/component/dropdown/dropdown.html.twig', { + source: source, + choices: choices, + value: filter, + }) }} + {% endset %} - + }) + +{%- endblock -%} diff --git a/src/Resources/views/themes/admin/ezdataflow/Dashboard/main.html.twig b/src/Resources/views/themes/admin/ezdataflow/Dashboard/main.html.twig index b90c902..77072bd 100644 --- a/src/Resources/views/themes/admin/ezdataflow/Dashboard/main.html.twig +++ b/src/Resources/views/themes/admin/ezdataflow/Dashboard/main.html.twig @@ -1,80 +1,101 @@ -{% extends ["@ezdesign/layout.html.twig", "@ezdesign/ui/layout.html.twig"] %} +{% extends "@ibexadesign/ui/layout.html.twig" %} -{% block body_class %}ez-has-full-width-footer{% endblock %} +{% block body_class %}ibexa-ezdataflow{% endblock %} {% block breadcrumbs %} - {% include ['@ezdesign/parts/breadcrumbs.html.twig', '@ezdesign/ui/breadcrumbs.html.twig'] with { items: [ + {% include '@ibexadesign/ui/breadcrumbs.html.twig' with { items: [ { value: 'breadcrumb.admin'|trans(domain='messages')|desc('Admin') }, { value: 'coderhapsodie.ezdataflow'|trans|desc('EzDataflow') } ]} %} {% endblock %} -{% block page_title %} - {% include ['@ezdesign/parts/page_title.html.twig', '@ezdesign/ui/page_title.html.twig'] with { +{% block header %} + {% include '@ibexadesign/ui/page_title.html.twig' with { title: 'coderhapsodie.ezdataflow'|trans|desc('EzDataflow'), - iconName: 'workflow' } %} {% endblock %} {% block content %} - {{ ez_render_component_group('coderhapsodie-ezdataflow', {'filter': app.request.query.get('filter', 0)}, '@ezdesign/ezdataflow/parts/tab/ezdataflow.html.twig') }} + {{ ibexa_render_component_group('coderhapsodie-ezdataflow', {'filter': app.request.query.get('filter', 0)}) }} - + {% embed '@ibexadesign/ui/component/modal/modal.html.twig' with { + id: 'modal-history-details', + attr_dialog: {'style': 'max-width: 75vw;'}, + title: 'coderhapsodie.ezdataflow.history.job.title'|trans, + } %} + {% block body_content '' %} + {% endembed %} - {% endblock %} + +{% block stylesheets %} + {{ parent() }} + +{% endblock %} diff --git a/src/Resources/views/themes/admin/ezdataflow/Dashboard/oneshot.html.twig b/src/Resources/views/themes/admin/ezdataflow/Dashboard/oneshot.html.twig index eb51069..da0a86e 100644 --- a/src/Resources/views/themes/admin/ezdataflow/Dashboard/oneshot.html.twig +++ b/src/Resources/views/themes/admin/ezdataflow/Dashboard/oneshot.html.twig @@ -1,60 +1,57 @@ -

    {{ 'coderhapsodie.ezdataflow.oneshot.title'|trans }}

    - -
    -
    {{ 'coderhapsodie.ezdataflow.oneshot.list.title'|trans }}
    -
    - -
    -
    - -{{ include('@ezdesign/ezdataflow/parts/tab/job_list.html.twig', {identifier: 'ezdataflow_oneshot_history', paginate_route: 'coderhapsodie.ezdataflow.oneshot'}) }} - -{% if form is defined %} - {% form_theme form 'bootstrap_3_layout.html.twig' %} - + {% endset %} + + {{ include('@ibexadesign/ezdataflow/parts/tab/job_list.html.twig', { + identifier: 'ezdataflow_oneshot_history', + paginate_route: 'coderhapsodie.ezdataflow.oneshot', + headline: 'coderhapsodie.ezdataflow.oneshot.title'|trans, + actions: actions, + }) }} + + {% if form is defined %} + {{ include('@ibexadesign/ezdataflow/parts/form_modal.html.twig', { + 'id': 'modal-new-oneshot', + 'form': form, + 'mode': 'oneshot' + }) }} + {% endif %} - - -{% endif %} +{%- endblock -%} diff --git a/src/Resources/views/themes/admin/ezdataflow/Dashboard/repeating.html.twig b/src/Resources/views/themes/admin/ezdataflow/Dashboard/repeating.html.twig index cdd2f19..150640a 100644 --- a/src/Resources/views/themes/admin/ezdataflow/Dashboard/repeating.html.twig +++ b/src/Resources/views/themes/admin/ezdataflow/Dashboard/repeating.html.twig @@ -1,185 +1,158 @@ -

    {{ 'coderhapsodie.ezdataflow.repeating.title'|trans }}

    +{%- block content -%} -
    -
    {{ 'coderhapsodie.ezdataflow.workflow.list.title'|trans }}
    -
    - -
    -
    + {{ include('@ibexadesign/ezdataflow/parts/tab/schedule_list.html.twig', { + identifier: 'ezdataflow_schedule_results', + paginate_route: 'coderhapsodie.ezdataflow.repeating' + }) }} -{{ include('@ezdesign/ezdataflow/parts/tab/schedule_list.html.twig', {identifier: 'ezdataflow_schedule_results', paginate_route: 'coderhapsodie.ezdataflow.repeating'}) }} + {{ include('@ibexadesign/ezdataflow/parts/form_modal.html.twig', { + 'id': 'modal-new-scheduled', + 'form': form + }) }} -{% if form is defined %} - {% form_theme form 'bootstrap_3_layout.html.twig' %} - + {% embed '@ibexadesign/ui/component/modal/modal.html.twig' with { + id: 'modal-edit-scheduled', + title: 'coderhapsodie.ezdataflow.workflow.repeating.edit.title'|trans, + } %} + {% block body_content %} +
    +
    +
    + + {% endblock %} + {% endembed %} - - - - - - + {% embed '@ibexadesign/ui/component/modal/modal.html.twig' with { + id: 'modal-delete-confirm', + title: 'coderhapsodie.ezdataflow.workflow.delete'|trans, + } %} + {% block body_content %} +
    +
    +
    + + {% endblock %} + {% endembed %} -{% endif %} +{%- endblock -%} diff --git a/src/Resources/views/themes/admin/ezdataflow/Dashboard/schedule_history.html.twig b/src/Resources/views/themes/admin/ezdataflow/Dashboard/schedule_history.html.twig index 8b12614..5910edb 100644 --- a/src/Resources/views/themes/admin/ezdataflow/Dashboard/schedule_history.html.twig +++ b/src/Resources/views/themes/admin/ezdataflow/Dashboard/schedule_history.html.twig @@ -1,7 +1,5 @@ -

    {{ 'coderhapsodie.ezdataflow.history.title'|trans }}

    - -
    -
    {{ 'coderhapsodie.ezdataflow.history.list.title'|trans }}
    -
    - -{% include '@ezdesign/ezdataflow/parts/tab/job_list.html.twig' with {identifier: 'ezdataflow_schedule_history_results', paginate_route: 'coderhapsodie.ezdataflow.history.workflow', paginate_params: {id: id}} %} \ No newline at end of file +{% include '@ibexadesign/ezdataflow/parts/tab/job_list.html.twig' with { + identifier: 'ezdataflow_schedule_history_results', + paginate_route: 'coderhapsodie.ezdataflow.history.workflow', + paginate_params: {id: id} +} %} diff --git a/src/Resources/views/themes/admin/ezdataflow/Item/details.html.twig b/src/Resources/views/themes/admin/ezdataflow/Item/details.html.twig index 419b376..f8830ef 100644 --- a/src/Resources/views/themes/admin/ezdataflow/Item/details.html.twig +++ b/src/Resources/views/themes/admin/ezdataflow/Item/details.html.twig @@ -1,4 +1,4 @@ -{% import '@ezdesign/ezdataflow/macros.twig' as macros %} +{% import '@ibexadesign/ezdataflow/macros.twig' as macros %} {% block content %}
    @@ -20,7 +20,7 @@ {{ 'coderhapsodie.ezdataflow.history.details.request'|trans }} - {{ date(item.requestedDate)|ez_short_datetime }} + {{ date(item.requestedDate)|ibexa_short_datetime }} {{ 'coderhapsodie.ezdataflow.history.details.status'|trans }} @@ -28,11 +28,11 @@ {{ 'coderhapsodie.ezdataflow.history.details.start'|trans }} - {{ item.startTime ? date(item.startTime)|ez_short_datetime : '—' }} + {{ item.startTime ? date(item.startTime)|ibexa_short_datetime : '—' }} {{ 'coderhapsodie.ezdataflow.history.details.end'|trans }} - {{ item.endTime ? date(item.endTime)|ez_short_datetime : '—' }} + {{ item.endTime ? date(item.endTime)|ibexa_short_datetime : '—' }} {{ 'coderhapsodie.ezdataflow.history.details.count'|trans }} diff --git a/src/Resources/views/themes/admin/ezdataflow/form_theme.html.twig b/src/Resources/views/themes/admin/ezdataflow/form_theme.html.twig new file mode 100644 index 0000000..ac0fddf --- /dev/null +++ b/src/Resources/views/themes/admin/ezdataflow/form_theme.html.twig @@ -0,0 +1,10 @@ +{% extends '@ibexadesign/ui/form_fields.html.twig' %} + +{%- block checkbox_widget -%} + {{ block('toggle_widget') }} +{%- endblock -%} + +{% block datetime_widget -%} + {% set attr = attr|merge({class: (attr.class|default('') ~ ' ezdataflow-date')|trim}) %} + {{ parent() }} +{%- endblock datetime_widget %} diff --git a/src/Resources/views/themes/admin/ezdataflow/parts/form_modal.html.twig b/src/Resources/views/themes/admin/ezdataflow/parts/form_modal.html.twig new file mode 100644 index 0000000..338fb9d --- /dev/null +++ b/src/Resources/views/themes/admin/ezdataflow/parts/form_modal.html.twig @@ -0,0 +1,23 @@ +{% form_theme form '@ibexadesign/ezdataflow/form_theme.html.twig' %} + +{% embed '@ibexadesign/ui/component/modal/modal.html.twig' with { + id: id ?? '', + title: ('coderhapsodie.ezdataflow.workflow.'~(mode|default('repeating'))~'.'~(type_action|default('new'))~'.title')|trans, +} %} + {% block body_content %} + {{ form_start(form) }} +
    + {{ form_widget(form) }} +
    + + {{ form_end(form) }} + {% endblock %} + {% block footer_content %} + + + {% endblock %} +{% endembed %} diff --git a/src/Resources/views/themes/admin/ezdataflow/parts/schedule_form.html.twig b/src/Resources/views/themes/admin/ezdataflow/parts/schedule_form.html.twig deleted file mode 100644 index 4bf8fc9..0000000 --- a/src/Resources/views/themes/admin/ezdataflow/parts/schedule_form.html.twig +++ /dev/null @@ -1,24 +0,0 @@ -{% form_theme form 'bootstrap_3_layout.html.twig' %} - -{{ form_start(form) }} - -{{ form_end(form) }} diff --git a/src/Resources/views/themes/admin/ezdataflow/parts/tab/ezdataflow.html.twig b/src/Resources/views/themes/admin/ezdataflow/parts/tab/ezdataflow.html.twig deleted file mode 100644 index 575a627..0000000 --- a/src/Resources/views/themes/admin/ezdataflow/parts/tab/ezdataflow.html.twig +++ /dev/null @@ -1,27 +0,0 @@ -
    -
    - -
    -
    -
    - {% for tab in tabs %} - {% set id = group ~ '-' ~ tab.identifier %} - {% set active = loop.first %} - -
    - {{ tab.view|raw }} -
    - {% endfor %} -
    - diff --git a/src/Resources/views/themes/admin/ezdataflow/parts/tab/job_list.html.twig b/src/Resources/views/themes/admin/ezdataflow/parts/tab/job_list.html.twig index 5b1952b..cff1845 100644 --- a/src/Resources/views/themes/admin/ezdataflow/parts/tab/job_list.html.twig +++ b/src/Resources/views/themes/admin/ezdataflow/parts/tab/job_list.html.twig @@ -1,83 +1,117 @@ {% set id = identifier|default('ezdataflow_history_results') %} -{% import '@ezdesign/ezdataflow/macros.twig' as macros %} +{% import '@ibexadesign/ezdataflow/macros.twig' as macros %} -
    +
    - {% if pager.currentPageResults|length %} - - - - - - - - - - - - - - {% for job in pager.currentPageResults %} - - - - - - - - - - {% endfor %} - -
    {{ 'coderhapsodie.ezdataflow.history.list.name'|trans }}{{ 'coderhapsodie.ezdataflow.history.list.request'|trans }}{{ 'coderhapsodie.ezdataflow.history.list.count'|trans }}{{ 'coderhapsodie.ezdataflow.history.list.start'|trans }}{{ 'coderhapsodie.ezdataflow.history.list.end'|trans }}{{ 'coderhapsodie.ezdataflow.history.list.status'|trans }}
    {{ job.label }}{{ date(job.requested_date)|ez_short_datetime }}{{ job.count|default('—') }}{{ job.start_time ? date(job.start_time)|ez_short_datetime : '—' }}{{ job.end_time ? date(job.end_time)|ez_short_datetime : '—' }}{{ macros.translateStatus(job.status) }} - - - - - - - - - - -
    - {% else %} -

    {{ 'coderhapsodie.ezdataflow.history.list.empty'|trans }}

    - {% endif %} + + {% set body_rows = [] %} + + {% for job in pager.currentPageResults %} + {% set body_row_cols = [] %} + {% set body_row_cols = body_row_cols|merge([ + {content: job.label}, + {content: date(job.requested_date)|ibexa_short_datetime}, + {content: job.count|default('—')}, + {content: job.start_time ? date(job.start_time)|ibexa_short_datetime : '—'}, + {content: job.end_time ? date(job.end_time)|ibexa_short_datetime : '—'}, + {content: macros.translateStatus(job.status)}, + ]) %} + + {% set col_raw %} + + + + + + + + + + + {% endset %} + {% set body_row_cols = body_row_cols|merge([{ + has_action_btns: true, + content: col_raw, + raw: true, + }]) %} + + {% set body_rows = body_rows|merge([{ cols: body_row_cols }]) %} + {% endfor %} + + {% embed '@ibexadesign/ui/component/table/table.html.twig' with { + headline: headline ?? null, + head_cols: [ + { content: 'coderhapsodie.ezdataflow.history.list.name'|trans }, + { content: 'coderhapsodie.ezdataflow.history.list.request'|trans }, + { content: 'coderhapsodie.ezdataflow.history.list.count'|trans }, + { content: 'coderhapsodie.ezdataflow.history.list.start'|trans }, + { content: 'coderhapsodie.ezdataflow.history.list.end'|trans }, + { content: 'coderhapsodie.ezdataflow.history.list.status'|trans }, + { }, + ], + body_rows, + empty_table_info_text: 'coderhapsodie.ezdataflow.history.list.empty'|trans, + } %} + {% block header %} + {% embed '@ibexadesign/ui/component/table/table_header.html.twig' %} + {% block actions %} + {{ actions ?? '' }} + {% endblock %} + {% endembed %} + {% endblock %} + {% endembed %} {% if pager.haveToPaginate %} -
    - {{ pagerfanta(pager, 'ez', {routeName: paginate_route, routeParams: paginate_params|default({})}) }} -
    + {% include '@ibexadesign/ui/pagination.html.twig' with { + 'pager': pager, + 'paginaton_params': { + 'routeName': paginate_route, + 'routeParams': paginate_params|default({}) + } + } %} {% endif %}
    diff --git a/src/Resources/views/themes/admin/ezdataflow/parts/tab/schedule_list.html.twig b/src/Resources/views/themes/admin/ezdataflow/parts/tab/schedule_list.html.twig index ce2bda6..e5b0ede 100644 --- a/src/Resources/views/themes/admin/ezdataflow/parts/tab/schedule_list.html.twig +++ b/src/Resources/views/themes/admin/ezdataflow/parts/tab/schedule_list.html.twig @@ -1,106 +1,152 @@ {% set id = identifier|default('ezdataflow_schedule_results') %} -
    +
    - {% if pager.currentPageResults|length %} - - - - - - - - - - - - {% for item in pager.currentPageResults %} - - - - - - - - {% endfor %} - -
    {{ 'coderhapsodie.ezdataflow.workflow.list.name'|trans }}{{ 'coderhapsodie.ezdataflow.workflow.list.frequency'|trans }}{{ 'coderhapsodie.ezdataflow.workflow.list.next_execution'|trans }}{{ 'coderhapsodie.ezdataflow.workflow.list.enabled'|trans }}
    {{ item.label }}{{ item.frequency }}{{ date(item.next)|ez_short_datetime }}{{ ('coderhapsodie.ezdataflow.' ~ (item.enabled ? 'yes' : 'no'))|trans }} - - - - - - - - - - - {% if item.enabled %} - - - - - - {% else %} - - - - - - {% endif %} - -
    - {% else %} -

    {{ 'coderhapsodie.ezdataflow.workflow.list.empty'|trans }}

    - {% endif %} + {% set body_rows = [] %} + + {% for item in pager.currentPageResults %} + {% set body_row_cols = [] %} + {% set body_row_cols = body_row_cols|merge([ + {content: item.label}, + {content: item.frequency}, + {content: date(item.next)|ibexa_short_datetime}, + {content: ('coderhapsodie.ezdataflow.' ~ (item.enabled ? 'yes' : 'no'))|trans}, + ]) %} + + {% set col_raw %} + + + + + + + + + + + {% if item.enabled %} + + + + + + {% else %} + + + + + + {% endif %} + + + + + + {% endset %} + {% set body_row_cols = body_row_cols|merge([{ + has_action_btns: true, + content: col_raw, + raw: true, + }]) %} + + {% set body_rows = body_rows|merge([{ cols: body_row_cols }]) %} + {% endfor %} + + {% embed '@ibexadesign/ui/component/table/table.html.twig' with { + headline: 'coderhapsodie.ezdataflow.workflow.list.title'|trans, + head_cols: [ + { content: 'coderhapsodie.ezdataflow.workflow.list.name'|trans }, + { content: 'coderhapsodie.ezdataflow.workflow.list.frequency'|trans }, + { content: 'coderhapsodie.ezdataflow.workflow.list.next_execution'|trans }, + { content: 'coderhapsodie.ezdataflow.workflow.list.enabled'|trans }, + { }, + ], + body_rows, + empty_table_info_text: 'coderhapsodie.ezdataflow.workflow.list.empty'|trans, + } %} + {% block header %} + {% embed '@ibexadesign/ui/component/table/table_header.html.twig' %} + {% block actions %} + + {% endblock %} + {% endembed %} + {% endblock %} + {% endembed %} {% if pager.haveToPaginate %} -
    - {{ pagerfanta(pager, 'ez', {routeName: paginate_route, routeParams: paginate_params|default({})}) }} -
    + {% include '@ibexadesign/ui/pagination.html.twig' with { + 'pager': pager, + 'paginaton_params': { + 'routeName': paginate_route, + 'routeParams': paginate_params|default({}) + } + } %} {% endif %}
    diff --git a/src/Security/PolicyProvider.php b/src/Security/PolicyProvider.php index 3edc6c3..0cff077 100644 --- a/src/Security/PolicyProvider.php +++ b/src/Security/PolicyProvider.php @@ -4,8 +4,8 @@ namespace CodeRhapsodie\EzDataflowBundle\Security; -use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Security\PolicyProvider\PolicyProviderInterface; -use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Security\PolicyProvider\YamlPolicyProvider; +use Ibexa\Bundle\Core\DependencyInjection\Security\PolicyProvider\PolicyProviderInterface; +use Ibexa\Bundle\Core\DependencyInjection\Security\PolicyProvider\YamlPolicyProvider; class PolicyProvider extends YamlPolicyProvider implements PolicyProviderInterface { diff --git a/src/Tab/HistoryTab.php b/src/Tab/HistoryTab.php index 3274ecf..aee41b7 100644 --- a/src/Tab/HistoryTab.php +++ b/src/Tab/HistoryTab.php @@ -5,8 +5,8 @@ namespace CodeRhapsodie\EzDataflowBundle\Tab; use CodeRhapsodie\EzDataflowBundle\Controller\DashboardController; -use EzSystems\EzPlatformAdminUi\Tab\AbstractControllerBasedTab; -use EzSystems\EzPlatformAdminUi\Tab\OrderedTabInterface; +use Ibexa\Contracts\AdminUi\Tab\AbstractControllerBasedTab; +use Ibexa\Contracts\AdminUi\Tab\OrderedTabInterface; use Symfony\Component\HttpKernel\Controller\ControllerReference; class HistoryTab extends AbstractControllerBasedTab implements OrderedTabInterface diff --git a/src/Tab/OneshotTab.php b/src/Tab/OneshotTab.php index 34e3cb3..8315aa1 100644 --- a/src/Tab/OneshotTab.php +++ b/src/Tab/OneshotTab.php @@ -5,8 +5,8 @@ namespace CodeRhapsodie\EzDataflowBundle\Tab; use CodeRhapsodie\EzDataflowBundle\Controller\DashboardController; -use EzSystems\EzPlatformAdminUi\Tab\AbstractControllerBasedTab; -use EzSystems\EzPlatformAdminUi\Tab\OrderedTabInterface; +use Ibexa\Contracts\AdminUi\Tab\AbstractControllerBasedTab; +use Ibexa\Contracts\AdminUi\Tab\OrderedTabInterface; use Symfony\Component\HttpKernel\Controller\ControllerReference; class OneshotTab extends AbstractControllerBasedTab implements OrderedTabInterface diff --git a/src/Tab/RepeatingTab.php b/src/Tab/RepeatingTab.php index 9be0465..36c1a39 100644 --- a/src/Tab/RepeatingTab.php +++ b/src/Tab/RepeatingTab.php @@ -5,8 +5,8 @@ namespace CodeRhapsodie\EzDataflowBundle\Tab; use CodeRhapsodie\EzDataflowBundle\Controller\DashboardController; -use EzSystems\EzPlatformAdminUi\Tab\AbstractControllerBasedTab; -use EzSystems\EzPlatformAdminUi\Tab\OrderedTabInterface; +use Ibexa\Contracts\AdminUi\Tab\AbstractControllerBasedTab; +use Ibexa\Contracts\AdminUi\Tab\OrderedTabInterface; use Symfony\Component\HttpKernel\Controller\ControllerReference; class RepeatingTab extends AbstractControllerBasedTab implements OrderedTabInterface diff --git a/src/UserSwitcher/UserSwitcher.php b/src/UserSwitcher/UserSwitcher.php index 4cc620c..a77d1a5 100644 --- a/src/UserSwitcher/UserSwitcher.php +++ b/src/UserSwitcher/UserSwitcher.php @@ -4,22 +4,21 @@ namespace CodeRhapsodie\EzDataflowBundle\UserSwitcher; -use eZ\Publish\API\Repository\PermissionResolver; -use eZ\Publish\API\Repository\UserService; -use eZ\Publish\API\Repository\Values\User\UserReference; +use Ibexa\Contracts\Core\Repository\PermissionResolver; +use Ibexa\Contracts\Core\Repository\UserService; class UserSwitcher implements UserSwitcherInterface { - /** @var PermissionResolver */ + /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver */ private $permissionResolver; - /** @var UserService */ + /** @var \Ibexa\Contracts\Core\Repository\UserService */ private $userService; /** @var string|int */ private $adminLoginOrId; - /** @var UserReference[] */ + /** @var \Ibexa\Contracts\Core\Repository\Values\User\UserReference[] */ private $userStack; public function __construct(PermissionResolver $permissionResolver, UserService $userService, $adminLoginOrId) diff --git a/src/Writer/ContentWriter.php b/src/Writer/ContentWriter.php index e73d5cd..c4da68d 100644 --- a/src/Writer/ContentWriter.php +++ b/src/Writer/ContentWriter.php @@ -16,10 +16,10 @@ class ContentWriter extends RepositoryWriter implements DelegateWriterInterface { use LoggerAwareTrait; - /** @var ContentCreatorInterface */ + /** @var \CodeRhapsodie\EzDataflowBundle\Core\Content\ContentCreatorInterface */ private $creator; - /** @var ContentUpdaterInterface */ + /** @var \CodeRhapsodie\EzDataflowBundle\Core\Content\ContentUpdaterInterface */ private $updater; public function __construct(ContentCreatorInterface $creator, ContentUpdaterInterface $updater) @@ -29,7 +29,7 @@ public function __construct(ContentCreatorInterface $creator, ContentUpdaterInte } /** - * @param ContentStructure $item + * @param \CodeRhapsodie\EzDataflowBundle\Model\ContentStructure $item */ public function write($item) { @@ -44,14 +44,14 @@ public function write($item) 'content_type' => $item->getContentTypeIdentifier(), 'content_location' => $item->getLocations(), ]); + $this->creator->createFromStructure($item); - return $this->creator->createFromStructure($item); + return; } if ($item instanceof ContentUpdateStructure) { $this->log('info', 'Update content', ['id' => $item->getId(), 'remote_id' => $item->getRemoteId()]); - - return $this->updater->updateFromStructure($item); + $this->updater->updateFromStructure($item); } } diff --git a/tests/Core/FieldComparator/DelegatorFieldComparatorTest.php b/tests/Core/FieldComparator/DelegatorFieldComparatorTest.php index 590993a..d36ccef 100644 --- a/tests/Core/FieldComparator/DelegatorFieldComparatorTest.php +++ b/tests/Core/FieldComparator/DelegatorFieldComparatorTest.php @@ -4,12 +4,12 @@ use CodeRhapsodie\EzDataflowBundle\Core\FieldComparator\DelegatorFieldComparator; use CodeRhapsodie\EzDataflowBundle\Core\FieldComparator\FieldComparatorInterface; -use eZ\Publish\API\Repository\Values\Content\Field; +use Ibexa\Contracts\Core\Repository\Values\Content\Field; use PHPUnit\Framework\TestCase; class DelegatorFieldComparatorTest extends TestCase { - /** @var DelegatorFieldComparator */ + /** @var \CodeRhapsodie\EzDataflowBundle\Core\FieldComparator\DelegatorFieldComparator */ private $delegatorFieldComparator; protected function setUp(): void diff --git a/tests/Filter/NotModifiedContentFilterTest.php b/tests/Filter/NotModifiedContentFilterTest.php index 9b608a5..562b333 100644 --- a/tests/Filter/NotModifiedContentFilterTest.php +++ b/tests/Filter/NotModifiedContentFilterTest.php @@ -7,21 +7,21 @@ use CodeRhapsodie\EzDataflowBundle\Core\FieldComparator\FieldComparatorInterface; use CodeRhapsodie\EzDataflowBundle\Filter\NotModifiedContentFilter; use CodeRhapsodie\EzDataflowBundle\Model\ContentUpdateStructure; -use eZ\Publish\API\Repository\ContentService; -use eZ\Publish\API\Repository\Values\Content\Field; -use eZ\Publish\Core\Repository\Values\Content\Content; +use Ibexa\Contracts\Core\Repository\ContentService; +use Ibexa\Contracts\Core\Repository\Values\Content\Field; +use Ibexa\Core\Repository\Values\Content\Content; use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class NotModifiedContentFilterTest extends TestCase { - /** @var ContentService|MockObject */ + /** @var \Ibexa\Contracts\Core\Repository\ContentService|\PHPUnit\Framework\MockObject\MockObject */ private $contentServiceMock; - /** @var FieldComparatorInterface|MockObject */ + /** @var \CodeRhapsodie\EzDataflowBundle\Core\FieldComparator\FieldComparatorInterface|\PHPUnit\Framework\MockObject\MockObject */ private $comparatorMock; - /** @var NotModifiedContentFilter */ + /** @var \CodeRhapsodie\EzDataflowBundle\Filter\NotModifiedContentFilter */ private $notModifiedContentFilter; protected function setUp(): void