Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"license": "EUPL-1.2",
"minimum-stability": "dev",
"require": {
"php": ">=7.4",
"commongateway/corebundle": "^1.1.52"
"php": ">=8.2",
"commongateway/corebundle": "^1.1.52 | dev-feature/GW-1596/Symfony54 | dev-feature/GW-1595/Symfony64"
},
"require-dev": {
"symfony/dependency-injection": "~3.4|~4.1|~5.0"
Expand Down
85 changes: 16 additions & 69 deletions src/Service/SyncOpenWooService.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
use App\Entity\ObjectEntity;
use App\Service\ObjectEntityService;
use App\Service\SynchronizationService;
use CommonGateway\CoreBundle\Service\ActionService;
use CommonGateway\CoreBundle\Service\CallService;
use CommonGateway\CoreBundle\Service\GatewayResourceService;
use CommonGateway\CoreBundle\Service\MappingService;
use CommonGateway\CoreBundle\Service\HydrationService;
use CommonGateway\CoreBundle\Service\ValidationService;
use CommonGateway\CoreBundle\Service\CacheService;
use CommonGateway\WOOBundle\Service\FileService;
use Doctrine\ORM\EntityManagerInterface;
use Psr\Cache\CacheException;
use Psr\Cache\InvalidArgumentException;
Expand All @@ -37,54 +37,10 @@ class SyncOpenWooService
{

/**
* @var GatewayResourceService
*/
private GatewayResourceService $resourceService;

/**
* @var CallService
*/
private CallService $callService;

/**
* @var SynchronizationService
*/
private SynchronizationService $syncService;

/**
* @var MappingService
*/
private MappingService $mappingService;

/**
* @var EntityManagerInterface
*/
private EntityManagerInterface $entityManager;

/**
* @var SymfonyStyle|null
*/
private ?SymfonyStyle $style = null;

/**
* @var LoggerInterface $logger.
* @var LoggerInterface $logger The plugin logger.
*/
private LoggerInterface $logger;

/**
* @var ValidationService $validationService.
*/
private ValidationService $validationService;

/**
* @var CacheService $cacheService.
*/
private CacheService $cacheService;

private FileService $fileService;

private ObjectEntityService $gatewayOEService;

/**
* @var array
*/
Expand All @@ -108,27 +64,18 @@ class SyncOpenWooService
* @param FileService $fileService
*/
public function __construct(
GatewayResourceService $resourceService,
CallService $callService,
SynchronizationService $syncService,
EntityManagerInterface $entityManager,
MappingService $mappingService,
private readonly GatewayResourceService $resourceService,
private readonly CallService $callService,
private readonly SynchronizationService $syncService,
private readonly EntityManagerInterface $entityManager,
private readonly MappingService $mappingService,
LoggerInterface $pluginLogger,
ValidationService $validationService,
CacheService $cacheService,
FileService $fileService,
ObjectEntityService $gatewayOEService
private readonly ValidationService $validationService,
private readonly CacheService $cacheService,
private readonly FileService $fileService,
private ActionService $actionService
) {
$this->resourceService = $resourceService;
$this->callService = $callService;
$this->syncService = $syncService;
$this->entityManager = $entityManager;
$this->mappingService = $mappingService;
$this->logger = $pluginLogger;
$this->validationService = $validationService;
$this->cacheService = $cacheService;
$this->fileService = $fileService;
$this->gatewayOEService = $gatewayOEService;
$this->logger = $pluginLogger;

}//end __construct()

Expand Down Expand Up @@ -164,7 +111,7 @@ public function setStyle(SymfonyStyle $style): self
private function deleteNonExistingObjects(array $idsSynced, Source $source, string $schemaRef, string $categorie): int
{
// Get all existing sourceIds.
$source = $this->entityManager->find('App:Gateway', $source->getId()->toString());
$source = $this->entityManager->find(Source::class, $source->getId()->toString());
$existingSourceIds = [];
$existingObjects = [];
foreach ($source->getSynchronizations() as $synchronization) {
Expand Down Expand Up @@ -347,7 +294,7 @@ public function syncOpenWooHandler(array $data, array $configuration): array
$documents[] = $renderedObject['metadata']['verzoek']['besluit'];
}
} catch (Exception $exception) {
$this->logger->error("Something wen't wrong synchronizing sourceId: {$result['UUID']} with error: {$exception->getMessage()}", ['plugin' => 'common-gateway/woo-bundle']);
$this->logger->error("Something wen't wrong synchronizing sourceId: {$result['ID']} with error: {$exception->getMessage()}", ['plugin' => 'common-gateway/woo-bundle', 'trace' => $exception->getTraceAsString()]);
continue;
}//end try
}//end foreach
Expand All @@ -357,7 +304,7 @@ public function syncOpenWooHandler(array $data, array $configuration): array
foreach ($documents as $document) {
$documentData['document'] = $document;
$documentData['source'] = $source->getReference();
$this->gatewayOEService->dispatchEvent('commongateway.action.event', $documentData, 'woo.openwoo.document.created');
$this->actionService->dispatchEvent('commongateway.action.event', $documentData, 'woo.openwoo.document.created');
}

$deletedObjectsCount = $this->deleteNonExistingObjects($idsSynced, $source, $this->configuration['schema'], $categorie);
Expand Down Expand Up @@ -388,7 +335,7 @@ public function syncOpenWooDocumentHandler(array $data, array $config): array
return $data;
}

$bijlageObject = $this->entityManager->getRepository('App:ObjectEntity')->find($document['_self']['id']);
$bijlageObject = $this->entityManager->getRepository(ObjectEntity::class)->find($document['_self']['id']);
if ($bijlageObject instanceof ObjectEntity === false) {
return $data;
}
Expand Down