Skip to content

Commit

Permalink
PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
rjzondervan committed Jan 29, 2025
1 parent 232a74e commit f6dafc3
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
10 changes: 9 additions & 1 deletion lib/Service/EndpointService.php
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,10 @@ private function processFilePartRule(Rule $rule, array $data, Endpoint $endpoint
throw new Exception('Filepart rules can only be applied after the object has been created');
}

if (isset($rule->getConfiguration()['fileparts_create']) === false) {
throw new Exception('No configuration found for fileparts_create');
}

$config = $rule->getConfiguration()['fileparts_create'];

$targetId = explode('/', $endpoint->getTargetId());
Expand Down Expand Up @@ -782,7 +786,7 @@ private function processFilePartRule(Rule $rule, array $data, Endpoint $endpoint
* @param string|null $objectId The id of the object.
*
* @return array The updated object data.
*
*
* @throws DoesNotExistException
* @throws LoaderError
* @throws MultipleObjectsReturnedException
Expand All @@ -792,6 +796,10 @@ private function processFilePartRule(Rule $rule, array $data, Endpoint $endpoint
*/
private function processFilePartUploadRule(Rule $rule, array $data, ?string $objectId = null): array
{
if (isset($rule->getConfiguration()['filepart_upload']) === false) {
throw new Exception('No configuration found for filepart_upload');
}

$config = $rule->getConfiguration()['filepart_upload'];

$mappedData = $data;
Expand Down
15 changes: 12 additions & 3 deletions lib/Service/SynchronizationService.php
Original file line number Diff line number Diff line change
Expand Up @@ -309,9 +309,9 @@ public function getObjectFromSource(Synchronization $synchronization, string $en
* @throws Exception If both dynamic and static endpoint configurations are missing or the endpoint cannot be determined.
*/
private function fetchExtraDataForObject(
Synchronization $synchronization,
array $extraDataConfig,
array $object, ?string
Synchronization $synchronization,
array $extraDataConfig,
array $object, ?string
$originId = null
)
{
Expand Down Expand Up @@ -1444,6 +1444,10 @@ private function getRuleById(string $id): ?Rule
*/
private function processFetchFileRule(Rule $rule, array $data): array
{
if (isset($rule->getConfiguration()['fetch_file'])) {
throw new Exception('No configuration found for fetch_file');
}

$config = $rule->getConfiguration()['fetch_file'];

$source = $this->sourceMapper->find($config['source']);
Expand Down Expand Up @@ -1477,6 +1481,11 @@ private function processFetchFileRule(Rule $rule, array $data): array
*/
private function processWriteFileRule(Rule $rule, array $data, string $objectId, int $registerId, int $schemaId): array
{

if (isset($rule->getConfiguration()['write_file'])) {
throw new Exception('No configuration found for write_file');
}

$config = $rule->getConfiguration()['write_file'];
$dataDot = new Dot($data);
$content = base64_decode($dataDot[$config['filePath']]);
Expand Down

0 comments on commit f6dafc3

Please sign in to comment.