-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'b-7.2.x-create-aggregate-service-OXDEV-8726' into b-7.2…
….x-extral-all-user-data-OXDEV-805
- Loading branch information
Showing
19 changed files
with
345 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
/** | ||
* Copyright © OXID eSales AG. All rights reserved. | ||
* See LICENSE file for license details. | ||
*/ | ||
|
||
namespace OxidEsales\GdprOptinModule\UserData\DataType; | ||
|
||
interface ResultFileInterface | ||
{ | ||
public function getFilename(): string; | ||
|
||
public function getContent(): string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
/** | ||
* Copyright © OXID eSales AG. All rights reserved. | ||
* See LICENSE file for license details. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace OxidEsales\GdprOptinModule\UserData\DataType; | ||
|
||
class TableCollection implements TableCollectionInterface | ||
{ | ||
/** | ||
* @param array<string, array<array<string, string>>> $dataCollection | ||
*/ | ||
public function __construct( | ||
protected string $collectionName, | ||
protected array $dataCollection | ||
) { | ||
} | ||
|
||
public function getCollectionName(): string | ||
{ | ||
return $this->collectionName; | ||
} | ||
|
||
public function getCollection(): array | ||
{ | ||
return $this->dataCollection; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
/** | ||
* Copyright © OXID eSales AG. All rights reserved. | ||
* See LICENSE file for license details. | ||
*/ | ||
|
||
namespace OxidEsales\GdprOptinModule\UserData\DataType; | ||
|
||
interface TableCollectionInterface | ||
{ | ||
public function getCollectionName(): string; | ||
|
||
/** | ||
* @return array<string, array<array<string, string>>> | ||
*/ | ||
public function getCollection(): array; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php | ||
|
||
/** | ||
* Copyright © OXID eSales AG. All rights reserved. | ||
* See LICENSE file for license details. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace OxidEsales\GdprOptinModule\UserData\Service; | ||
|
||
use OxidEsales\GdprOptinModule\UserData\DataType\TableCollection; | ||
use OxidEsales\GdprOptinModule\UserData\DataType\TableCollectionInterface; | ||
use OxidEsales\GdprOptinModule\UserData\Exception\AggregationTypeException; | ||
use OxidEsales\GdprOptinModule\UserData\Infrastructure\DataSelectorInterface; | ||
|
||
class CollectionAggregationService implements CollectionAggregationServiceInterface | ||
{ | ||
/** @var array<string, array<DataSelectorInterface>> */ | ||
protected array $groupedCollectors = []; | ||
|
||
/** | ||
* @param iterable<Object> $collectors | ||
*/ | ||
public function __construct( | ||
iterable $collectors | ||
) { | ||
foreach ($collectors as $collector) { | ||
if (!$collector instanceof DataSelectorInterface) { | ||
throw new AggregationTypeException(); | ||
} | ||
|
||
$this->groupedCollectors[$collector->getCollection()][] = $collector; | ||
} | ||
} | ||
|
||
/** | ||
* @return array<TableCollectionInterface> | ||
*/ | ||
public function collectUserData(string $userId): array | ||
{ | ||
$resultCollections = []; | ||
|
||
foreach ($this->groupedCollectors as $collectionName => $collectors) { | ||
$collectionData = []; | ||
foreach ($collectors as $oneCollector) { | ||
$collectionData[$oneCollector->getSelectionTable()] = $oneCollector->getDataForColumnValue($userId); | ||
} | ||
$resultCollections[] = new TableCollection($collectionName, $collectionData); | ||
} | ||
|
||
return $resultCollections; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
/** | ||
* Copyright © OXID eSales AG. All rights reserved. | ||
* See LICENSE file for license details. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace OxidEsales\GdprOptinModule\UserData\Service; | ||
|
||
use OxidEsales\GdprOptinModule\UserData\DataType\ResultFileInterface; | ||
use OxidEsales\GdprOptinModule\UserData\DataType\TableCollectionInterface; | ||
|
||
interface CollectionSerializerInterface | ||
{ | ||
public function serializeCollection(TableCollectionInterface $data): ResultFileInterface; | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.