Skip to content

Commit b4186ed

Browse files
jbcrmacintoshplus
andauthored
WIP: Add compatibilty to eZ Platform 3 (#20)
* update require to platform 3 * update admin to admin ui 2.0beta3 * some eZ Platform 3 change (#32) * bump eZ required version * enable autowire and autoconfigure on controller * use contracts dependency for translation interface instead of Component * change requirements * add change log Co-authored-by: Jean-Baptiste Nahan <814683+macintoshplus@users.noreply.github.com>
1 parent 657c269 commit b4186ed

25 files changed

Lines changed: 89 additions & 181 deletions

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# Version 3.0.0
2+
3+
* Add compatibility with Ibexa Content 3.3
4+
* Add compatibility with Symfony 5.x
5+
16
# Version 2.3.0
27

38
* Added a button to display exceptions / log in a modal

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@
4242
},
4343
"require": {
4444
"php": "^7.1",
45-
"code-rhapsodie/dataflow-bundle": "^2.1 || dev-master",
46-
"ezsystems/ezplatform-admin-ui": "^1.0",
47-
"ezsystems/ezpublish-kernel": "^7.0"
45+
"code-rhapsodie/dataflow-bundle": "^3.0",
46+
"ezsystems/ezplatform-admin-ui": "^2.3",
47+
"ezsystems/ezplatform-kernel": "^1.3"
4848
},
4949
"require-dev": {
50-
"phpunit/phpunit": "^7||^8",
50+
"phpunit/phpunit": "^7||^8||^9",
5151
"doctrine/dbal": "^2.0"
5252
},
5353
"minimum-stability": "dev",

src/Controller/DashboardController.php

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44

55
namespace CodeRhapsodie\EzDataflowBundle\Controller;
66

7+
use CodeRhapsodie\DataflowBundle\Entity\Job;
8+
use CodeRhapsodie\DataflowBundle\Entity\ScheduledDataflow;
79
use CodeRhapsodie\EzDataflowBundle\Form\CreateOneshotType;
810
use CodeRhapsodie\EzDataflowBundle\Form\CreateScheduledType;
911
use CodeRhapsodie\EzDataflowBundle\Gateway\JobGateway;
1012
use CodeRhapsodie\EzDataflowBundle\Gateway\ScheduledDataflowGateway;
11-
use CodeRhapsodie\DataflowBundle\Entity\Job;
12-
use CodeRhapsodie\DataflowBundle\Entity\ScheduledDataflow;
1313
use Doctrine\DBAL\Query\QueryBuilder;
1414
use eZ\Publish\Core\MVC\Symfony\Security\Authorization\Attribute;
1515
use EzSystems\EzPlatformAdminUi\Notification\NotificationHandlerInterface;
@@ -41,8 +41,6 @@ public function __construct(JobGateway $jobGateway, NotificationHandlerInterface
4141

4242
/**
4343
* @Route("/", name="coderhapsodie.ezdataflow.main")
44-
*
45-
* @return Response
4644
*/
4745
public function main(): Response
4846
{
@@ -69,10 +67,6 @@ public function repeating(Request $request): Response
6967

7068
/**
7169
* @Route("/repeating", name="coderhapsodie.ezdataflow.repeating")
72-
*
73-
* @param Request $request
74-
*
75-
* @return Response
7670
*/
7771
public function getRepeatingPage(Request $request): Response
7872
{
@@ -101,10 +95,6 @@ public function oneshot(Request $request): Response
10195

10296
/**
10397
* @Route("/oneshot", name="coderhapsodie.ezdataflow.oneshot")
104-
*
105-
* @param Request $request
106-
*
107-
* @return Response
10898
*/
10999
public function getOneshotPage(Request $request): Response
110100
{
@@ -126,10 +116,6 @@ public function history(Request $request): Response
126116

127117
/**
128118
* @Route("/history", name="coderhapsodie.ezdataflow.history")
129-
*
130-
* @param Request $request
131-
*
132-
* @return Response
133119
*/
134120
public function getHistoryPage(Request $request): Response
135121
{
@@ -142,11 +128,6 @@ public function getHistoryPage(Request $request): Response
142128

143129
/**
144130
* @Route("/history/schedule/{id}", name="coderhapsodie.ezdataflow.history.workflow")
145-
*
146-
* @param Request $request
147-
* @param int $id
148-
*
149-
* @return Response
150131
*/
151132
public function getHistoryForScheduled(Request $request, int $id): Response
152133
{

src/Controller/JobController.php

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
use Symfony\Component\HttpFoundation\Response;
1616
use Symfony\Component\Routing\Annotation\Route;
1717
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
18-
use Symfony\Component\Translation\TranslatorInterface;
18+
use Symfony\Contracts\Translation\TranslatorInterface;
1919

2020
/**
2121
* @Route("/ezdataflow/job")
@@ -26,7 +26,7 @@ class JobController extends Controller
2626
private $jobGateway;
2727
/** @var NotificationHandlerInterface */
2828
private $notificationHandler;
29-
/** @var TranslatorInterface */
29+
/** @var Symfony\Component\Translation\TranslatorInterface|Symfony\Contracts\Translation\TranslatorInterface */
3030
private $translator;
3131

3232
public function __construct(
@@ -41,10 +41,6 @@ public function __construct(
4141

4242
/**
4343
* @Route("/details/{id}", name="coderhapsodie.ezdataflow.job.details")
44-
*
45-
* @param int $id
46-
*
47-
* @return Response
4844
*/
4945
public function displayDetails(int $id): Response
5046
{
@@ -77,10 +73,6 @@ public function displayLog(int $id): Response
7773

7874
/**
7975
* @Route("/create", name="coderhapsodie.ezdataflow.job.create", methods={"POST"})
80-
*
81-
* @param Request $request
82-
*
83-
* @return Response
8476
*/
8577
public function create(Request $request): Response
8678
{

src/Controller/ScheduledDataflowController.php

Lines changed: 27 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@
44

55
namespace CodeRhapsodie\EzDataflowBundle\Controller;
66

7+
use CodeRhapsodie\DataflowBundle\Entity\ScheduledDataflow;
78
use CodeRhapsodie\EzDataflowBundle\Form\CreateScheduledType;
89
use CodeRhapsodie\EzDataflowBundle\Form\UpdateScheduledType;
9-
use CodeRhapsodie\EzDataflowBundle\Gateway\ScheduledDataflowGateway;
1010
use CodeRhapsodie\EzDataflowBundle\Gateway\JobGateway;
11-
use CodeRhapsodie\DataflowBundle\Entity\ScheduledDataflow;
11+
use CodeRhapsodie\EzDataflowBundle\Gateway\ScheduledDataflowGateway;
1212
use eZ\Publish\Core\MVC\Symfony\Security\Authorization\Attribute;
1313
use EzSystems\EzPlatformAdminUi\Notification\NotificationHandlerInterface;
1414
use EzSystems\EzPlatformAdminUiBundle\Controller\Controller;
1515
use Symfony\Component\HttpFoundation\JsonResponse;
1616
use Symfony\Component\HttpFoundation\Request;
1717
use Symfony\Component\HttpFoundation\Response;
1818
use Symfony\Component\Routing\Annotation\Route;
19-
use Symfony\Component\Translation\TranslatorInterface;
19+
use Symfony\Contracts\Translation\TranslatorInterface;
2020

2121
/**
2222
* @Route("/ezdataflow/scheduled_workflow")
@@ -32,8 +32,12 @@ class ScheduledDataflowController extends Controller
3232
/** @var TranslatorInterface */
3333
private $translator;
3434

35-
public function __construct(JobGateway $jobGateway, NotificationHandlerInterface $notificationHandler, ScheduledDataflowGateway $scheduledDataflowGateway, TranslatorInterface $translator)
36-
{
35+
public function __construct(
36+
JobGateway $jobGateway,
37+
NotificationHandlerInterface $notificationHandler,
38+
ScheduledDataflowGateway $scheduledDataflowGateway,
39+
TranslatorInterface $translator
40+
) {
3741
$this->jobGateway = $jobGateway;
3842
$this->notificationHandler = $notificationHandler;
3943
$this->scheduledDataflowGateway = $scheduledDataflowGateway;
@@ -42,10 +46,6 @@ public function __construct(JobGateway $jobGateway, NotificationHandlerInterface
4246

4347
/**
4448
* @Route("/create", name="coderhapsodie.ezdataflow.workflow.create", methods={"POST"})
45-
*
46-
* @param Request $request
47-
*
48-
* @return Response
4949
*/
5050
public function create(Request $request): Response
5151
{
@@ -63,7 +63,8 @@ public function create(Request $request): Response
6363
$this->scheduledDataflowGateway->save($newWorkflow);
6464
$this->notificationHandler->success($this->translator->trans('coderhapsodie.ezdataflow.workflow.create.success'));
6565
} catch (\Exception $e) {
66-
$this->notificationHandler->error($this->translator->trans('coderhapsodie.ezdataflow.workflow.create.error', ['message' => $e->getMessage()]));
66+
$this->notificationHandler->error($this->translator->trans('coderhapsodie.ezdataflow.workflow.create.error',
67+
['message' => $e->getMessage()]));
6768
}
6869

6970
return new JsonResponse(['redirect' => $this->generateUrl('coderhapsodie.ezdataflow.main')]);
@@ -79,10 +80,6 @@ public function create(Request $request): Response
7980

8081
/**
8182
* @Route("/{id}/delete", name="coderhapsodie.ezdataflow.workflow.delete", methods={"post"})
82-
*
83-
* @param int $id
84-
*
85-
* @return Response
8683
*/
8784
public function delete(int $id): Response
8885
{
@@ -94,19 +91,15 @@ public function delete(int $id): Response
9491

9592
return new JsonResponse(['code' => 200]);
9693
} catch (\Exception $e) {
97-
$this->notificationHandler->error($this->translator->trans('coderhapsodie.ezdataflow.workflow.delete.error', ['message' => $e->getMessage()]));
94+
$this->notificationHandler->error($this->translator->trans('coderhapsodie.ezdataflow.workflow.delete.error',
95+
['message' => $e->getMessage()]));
9896

9997
return new JsonResponse(['code' => $e->getCode()]);
10098
}
10199
}
102100

103101
/**
104102
* @Route("/{id}/edit", name="coderhapsodie.ezdataflow.workflow.edit")
105-
*
106-
* @param Request $request
107-
* @param int $id
108-
*
109-
* @return Response
110103
*/
111104
public function edit(Request $request, int $id): Response
112105
{
@@ -123,7 +116,8 @@ public function edit(Request $request, int $id): Response
123116
$this->scheduledDataflowGateway->save($editDataflow);
124117
$this->notificationHandler->success($this->translator->trans('coderhapsodie.ezdataflow.workflow.edit.success'));
125118
} catch (\Exception $e) {
126-
$this->notificationHandler->error($this->translator->trans('coderhapsodie.ezdataflow.workflow.edit.error', ['message' => $e->getMessage()]));
119+
$this->notificationHandler->error($this->translator->trans('coderhapsodie.ezdataflow.workflow.edit.error',
120+
['message' => $e->getMessage()]));
127121
}
128122

129123
return new JsonResponse(['redirect' => $this->generateUrl('coderhapsodie.ezdataflow.main')]);
@@ -139,10 +133,6 @@ public function edit(Request $request, int $id): Response
139133

140134
/**
141135
* @Route("/{id}/enable", name="coderhapsodie.ezdataflow.workflow.enable")
142-
*
143-
* @param int $id
144-
*
145-
* @return Response
146136
*/
147137
public function enableDataflow(int $id): Response
148138
{
@@ -153,22 +143,6 @@ public function enableDataflow(int $id): Response
153143
return $this->redirectToRoute('coderhapsodie.ezdataflow.main');
154144
}
155145

156-
/**
157-
* @Route("/{id}/disable", name="coderhapsodie.ezdataflow.workflow.disable")
158-
*
159-
* @param int $id
160-
*
161-
* @return Response
162-
*/
163-
public function disableDataflow(int $id): Response
164-
{
165-
$this->denyAccessUnlessGranted(new Attribute('ezdataflow', 'edit'));
166-
167-
$this->changeDataflowStatus($id, false);
168-
169-
return $this->redirectToRoute('coderhapsodie.ezdataflow.main');
170-
}
171-
172146
private function changeDataflowStatus(int $id, bool $status)
173147
{
174148
try {
@@ -182,4 +156,16 @@ private function changeDataflowStatus(int $id, bool $status)
182156
$this->notificationHandler->error(sprintf('An error occured : "%s".', $e->getMessage()));
183157
}
184158
}
159+
160+
/**
161+
* @Route("/{id}/disable", name="coderhapsodie.ezdataflow.workflow.disable")
162+
*/
163+
public function disableDataflow(int $id): Response
164+
{
165+
$this->denyAccessUnlessGranted(new Attribute('ezdataflow', 'edit'));
166+
167+
$this->changeDataflowStatus($id, false);
168+
169+
return $this->redirectToRoute('coderhapsodie.ezdataflow.main');
170+
}
185171
}

src/Core/Content/ContentCreator.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,6 @@ public function __construct(ContentService $contentService, ContentTypeService $
3535
}
3636

3737
/**
38-
* @param ContentCreateStructure $structure
39-
*
40-
* @return Content
41-
*
4238
* @throws \eZ\Publish\API\Repository\Exceptions\BadStateException
4339
* @throws \eZ\Publish\API\Repository\Exceptions\ContentFieldValidationException
4440
* @throws \eZ\Publish\API\Repository\Exceptions\ContentValidationException
@@ -58,8 +54,6 @@ public function createFromStructure(ContentCreateStructure $structure): Content
5854
}
5955

6056
/**
61-
* @param array $locations
62-
*
6357
* @return LocationCreateStruct[]
6458
*/
6559
private function getLocationCreateStructs(array $locations): array

src/Core/Content/ContentUpdater.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,6 @@ public function __construct(ContentService $contentService, ContentTypeService $
3030
}
3131

3232
/**
33-
* @param ContentUpdateStructure $structure
34-
*
35-
* @return Content
36-
*
3733
* @throws NoMatchFoundException
3834
* @throws \eZ\Publish\API\Repository\Exceptions\BadStateException
3935
* @throws \eZ\Publish\API\Repository\Exceptions\ContentFieldValidationException

src/Core/Field/ContentStructFieldFiller.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ class ContentStructFieldFiller implements ContentStructFieldFillerInterface
1717

1818
/**
1919
* ContentStructFieldFiller constructor.
20-
*
21-
* @param iterable $fieldValueCreators
2220
*/
2321
public function __construct(iterable $fieldValueCreators)
2422
{
@@ -47,10 +45,7 @@ public function fillFields(ContentType $contentType, ContentStruct $contentStruc
4745
}
4846

4947
/**
50-
* @param string $fieldTypeIdentifier
51-
* @param mixed $hash
52-
*
53-
* @return Value
48+
* @param mixed $hash
5449
*
5550
* @throws UnsupportedFieldTypeException
5651
*/

src/Core/Field/ContentStructFieldFillerInterface.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,5 @@
99

1010
interface ContentStructFieldFillerInterface
1111
{
12-
/**
13-
* @param ContentType $contentType
14-
* @param ContentStruct $contentStruct
15-
* @param array $fieldHashes
16-
*/
1712
public function fillFields(ContentType $contentType, ContentStruct $contentStruct, array $fieldHashes): void;
1813
}

src/Core/Field/DefaultFieldValueCreator.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
namespace CodeRhapsodie\EzDataflowBundle\Core\Field;
66

7-
use eZ\Publish\API\Repository\FieldType;
87
use eZ\Publish\API\Repository\FieldTypeService;
98
use eZ\Publish\Core\FieldType\Value;
109

0 commit comments

Comments
 (0)