-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add product installer connection (See #24)
* Support importing via the product installer 2922775 * - Structure modified cebef5b - Product Installer added to `setLoadAfter` * Consider archive connections 8aca2f6 * Add setUserGroupArchiveConnections fdcfd03 * Add translations 899ada2 --------- Co-authored-by: Daniele Sciannimanica <[email protected]>
- Loading branch information
Showing
7 changed files
with
146 additions
and
1 deletion.
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
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
42 changes: 42 additions & 0 deletions
42
src/EventListener/Import/AddRecommendationValidatorListener.php
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,42 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of Oveleon Recommendation Bundle. | ||
* | ||
* @package contao-recommendation-bundle | ||
* @license AGPL-3.0 | ||
* @author Daniele Sciannimanica <https://github.com/doishub> | ||
* @copyright Oveleon <https://www.oveleon.de/> | ||
*/ | ||
|
||
namespace Oveleon\ContaoRecommendationBundle\EventListener\Import; | ||
|
||
use Oveleon\ContaoRecommendationBundle\Import\Validator\RecommendationArchiveValidator; | ||
use Oveleon\ContaoRecommendationBundle\Model\RecommendationArchiveModel; | ||
use Oveleon\ProductInstaller\Import\Validator; | ||
use Oveleon\ProductInstaller\Import\Validator\ModuleValidator; | ||
|
||
class AddRecommendationValidatorListener | ||
{ | ||
public function addValidators(): void | ||
{ | ||
// Connects jumpTo pages | ||
Validator::addValidatorCollection([RecommendationArchiveValidator::class], ['setJumpToPageConnection']); | ||
} | ||
|
||
public function setModuleArchiveConnections(array $row): array | ||
{ | ||
return match ($row['type']) { | ||
'recommendationlist', 'recommendationreader' => ['field' => 'recommendation_archives', 'table' => RecommendationArchiveModel::getTable()], | ||
'recommendationform' => ['field' => 'recommendation_archive', 'table' => RecommendationArchiveModel::getTable()], | ||
default => [], | ||
}; | ||
} | ||
|
||
public function setUserGroupArchiveConnections(array &$connections): void | ||
{ | ||
$connections['recommendations'] = RecommendationArchiveModel::getTable(); | ||
} | ||
} |
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,23 @@ | ||
<?php | ||
|
||
namespace Oveleon\ContaoRecommendationBundle\Import\Validator; | ||
|
||
use Oveleon\ContaoRecommendationBundle\Model\RecommendationArchiveModel; | ||
|
||
/** | ||
* Validator class for validating the recommendation records during and after import. | ||
* | ||
* @author Daniele Sciannimanica <https://github.com/doishub> | ||
*/ | ||
class RecommendationArchiveValidator | ||
{ | ||
static public function getTrigger(): string | ||
{ | ||
return RecommendationArchiveModel::getTable(); | ||
} | ||
|
||
static public function getModel(): string | ||
{ | ||
return RecommendationArchiveModel::class; | ||
} | ||
} |
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,24 @@ | ||
<?php | ||
|
||
namespace Oveleon\ContaoRecommendationBundle\Import\Validator; | ||
|
||
use Oveleon\ContaoRecommendationBundle\Model\RecommendationModel; | ||
use Oveleon\ProductInstaller\Import\Validator\ValidatorInterface; | ||
|
||
/** | ||
* Validator class for validating the recommendation item records during and after import. | ||
* | ||
* @author Daniele Sciannimanica <https://github.com/doishub> | ||
*/ | ||
class RecommendationValidator implements ValidatorInterface | ||
{ | ||
static public function getTrigger(): string | ||
{ | ||
return RecommendationModel::getTable(); | ||
} | ||
|
||
static public function getModel(): string | ||
{ | ||
return RecommendationModel::class; | ||
} | ||
} |
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,23 @@ | ||
setup: | ||
tables: | ||
tl_recommendation_archive: 'Bewertungen-Archive' | ||
tl_recommendation: 'Bewertungen' | ||
prompt: | ||
recommendation_archive: | ||
jumpTo: | ||
label: 'Bewertungen-Archiv → Weiterleitungsseite' | ||
description: 'Ein oder mehrere Bewertungen-Archive verweisen auf eine Weiterleitungsseite, welche nicht aufgelöst werden kann. Ihre Auswahl wird für alle weiteren Bewertungen-Archive, welche auf die selbe Weiterleitungsseite referenzieren, übernommen.' | ||
explanation: 'Beim Importieren eines oder mehrerer Bewertungen-Archive konnte die zugehörige Weiterleitungsseite nicht gefunden werden. Wählen Sie bitte eine Seite aus Ihrer Contao-Instanz, um eine Verknüpfung zwischen diesen Archiven und einer Seite herzustellen.<br/><br/><b>Folgende Seite wurde nicht importiert und benötigt eine Alternative:</b>' | ||
module: | ||
recommendation_archives: | ||
label: 'Modul → Bewertungsarchive' | ||
description: 'Dem Modul konnten ein oder mehrere Archive nicht zugeordnet werden. Ihre Auswahl wird für das derzeitige Modul übernommen.' | ||
explanation: 'Beim Importieren eines oder mehrerer Module konnten zugehörige Archive nicht gefunden werden. Wählen Sie bitte ein Archiv aus Ihrer Contao-Instanz aus, um eine Verknüpfung zwischen diesem Modul und einem Archiv herzustellen.' | ||
recommendation_archive: | ||
label: 'Modul → Bewertungsarchiv' | ||
description: 'Dem Modul konnte kein Archiv nicht zugeordnet werden. Ihre Auswahl wird für das derzeitige Modul übernommen.' | ||
explanation: 'Beim Importieren eines Moduls konnte kein zugehöriges Archiv gefunden werden. Wählen Sie bitte ein Archiv aus Ihrer Contao-Instanz aus, um eine Verknüpfung zwischen diesem Modul und einem Archiv herzustellen.' | ||
user_group: | ||
recommendations: | ||
label: 'Benutzergruppe "%userGroupName%" → Bewertungsarchive' | ||
description: 'Ein oder mehrere Archive konnten nicht zugewiesen werden, bitte weisen Sie diese manuell zu.' |
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,23 @@ | ||
setup: | ||
tables: | ||
tl_recommendation_archive: 'Recommendation archives' | ||
tl_recommendation: 'Recommendations' | ||
prompt: | ||
recommendation_archive: | ||
jumpTo: | ||
label: 'Recommendation-Archive → Redirect page' | ||
description: 'One or more recommendation archives refer to a forwarding page that cannot be resolved. Your selection is applied to all other rating archives that reference the same redirection page.' | ||
explanation: 'When importing one or more recommendation archives, the corresponding redirect page could not be found. Please select a page from your Contao instance to create a link between these archives and a page.<br/><br/><b>The following page was not imported and needs an alternative:</b>' | ||
module: | ||
recommendation_archives: | ||
label: 'Module → Recommendation archives' | ||
description: 'One or more archives could not be assigned to the module. Your selection will be applied to the current module.' | ||
explanation: 'During the import of one or more modules, the corresponding archives could not be found. Please select an archive from your Contao instance to create a link between this module and an archive.' | ||
recommendation_archive: | ||
label: 'Module → Recommendation archive' | ||
description: 'No archive could not be assigned to the module. Your selection will be applied to the current module.' | ||
explanation: 'During the import of a module, no associated archive could be found. Please select an archive from your Contao instance to create a link between this module and an archive.' | ||
user_group: | ||
recommendations: | ||
label: 'User group "%userGroupName%" → Recommendation archives' | ||
description: 'One or more archives could not be assigned, please assign them manually.' |