Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e7f832fb53 | |||
| e5656424bc | |||
| 217d14e6cc |
+3
-3
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "eiswurm/nossenerland-import-bundle",
|
"name": "mummert/nossenerland-import-bundle",
|
||||||
"description": "Nossener Land event import bundle for Contao 5.7.",
|
"description": "Nossener Land event import bundle for Contao 5.7.",
|
||||||
"type": "contao-bundle",
|
"type": "contao-bundle",
|
||||||
"license": "proprietary",
|
"license": "proprietary",
|
||||||
@@ -13,11 +13,11 @@
|
|||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
"Eiswurm\\NossenerlandImportBundle\\": "src/"
|
"Mummert\\NossenerlandImportBundle\\": "src/"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"extra": {
|
"extra": {
|
||||||
"contao-manager-plugin": "Eiswurm\\NossenerlandImportBundle\\Contao\\Manager\\Plugin"
|
"contao-manager-plugin": "Mummert\\NossenerlandImportBundle\\Contao\\Manager\\Plugin"
|
||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
"allow-plugins": {
|
"allow-plugins": {
|
||||||
|
|||||||
@@ -3,13 +3,13 @@ services:
|
|||||||
autowire: true
|
autowire: true
|
||||||
autoconfigure: true
|
autoconfigure: true
|
||||||
|
|
||||||
Eiswurm\NossenerlandImportBundle\:
|
Mummert\NossenerlandImportBundle\:
|
||||||
resource: ../src/
|
resource: ../src/
|
||||||
exclude:
|
exclude:
|
||||||
- ../src/DependencyInjection/
|
- ../src/DependencyInjection/
|
||||||
- ../src/Contao/Manager/
|
- ../src/Contao/Manager/
|
||||||
- ../src/NossenerlandImportBundle.php
|
- ../src/NossenerlandImportBundle.php
|
||||||
|
|
||||||
Eiswurm\NossenerlandImportBundle\Command\ImportEventsCommand:
|
Mummert\NossenerlandImportBundle\Command\ImportEventsCommand:
|
||||||
arguments:
|
arguments:
|
||||||
$projectDir: '%kernel.project_dir%'
|
$projectDir: '%kernel.project_dir%'
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Eiswurm\NossenerlandImportBundle\Command;
|
namespace Mummert\NossenerlandImportBundle\Command;
|
||||||
|
|
||||||
use Contao\CoreBundle\Framework\ContaoFramework;
|
use Contao\CoreBundle\Framework\ContaoFramework;
|
||||||
use Contao\Dbafs;
|
use Contao\Dbafs;
|
||||||
@@ -196,6 +196,7 @@ class ImportEventsCommand extends Command
|
|||||||
'url' => sprintf('https://kirchspiel-nossener-land.de/termine/%s', $alias),
|
'url' => sprintf('https://kirchspiel-nossener-land.de/termine/%s', $alias),
|
||||||
'jumpTo' => 0,
|
'jumpTo' => 0,
|
||||||
'articleId' => 0,
|
'articleId' => 0,
|
||||||
|
'location_id' => (int) ($event['external_location'] ?? 0),
|
||||||
'target' => 1,
|
'target' => 1,
|
||||||
'termsAccepted' => '1',
|
'termsAccepted' => '1',
|
||||||
'tags' => serialize(self::DEFAULT_TAGS),
|
'tags' => serialize(self::DEFAULT_TAGS),
|
||||||
@@ -212,6 +213,7 @@ class ImportEventsCommand extends Command
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->syncOrganization($eventId);
|
$this->syncOrganization($eventId);
|
||||||
|
$this->syncTags($eventId, self::DEFAULT_TAGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function findEventIdByExternalId(string $externalId): int|null
|
private function findEventIdByExternalId(string $externalId): int|null
|
||||||
@@ -240,6 +242,33 @@ class ImportEventsCommand extends Command
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int[] $tagIds
|
||||||
|
*/
|
||||||
|
private function syncTags(int $eventId, array $tagIds): void
|
||||||
|
{
|
||||||
|
$normalizedTagIds = array_values(array_unique(array_map('intval', $tagIds)));
|
||||||
|
|
||||||
|
$this->connection->delete('tl_tags_rel', [
|
||||||
|
'pid' => $eventId,
|
||||||
|
'ptable' => 'tl_calendar_events',
|
||||||
|
'field' => 'tags',
|
||||||
|
]);
|
||||||
|
|
||||||
|
foreach ($normalizedTagIds as $tagId) {
|
||||||
|
if ($tagId <= 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->connection->insert('tl_tags_rel', [
|
||||||
|
'tag_id' => $tagId,
|
||||||
|
'pid' => $eventId,
|
||||||
|
'ptable' => 'tl_calendar_events',
|
||||||
|
'field' => 'tags',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private function generateAlias(string $title, int $startDate, string $preferredAlias, int|null $eventId): string
|
private function generateAlias(string $title, int $startDate, string $preferredAlias, int|null $eventId): string
|
||||||
{
|
{
|
||||||
$candidate = $preferredAlias !== '' ? $this->normalizeAlias($preferredAlias) : '';
|
$candidate = $preferredAlias !== '' ? $this->normalizeAlias($preferredAlias) : '';
|
||||||
|
|||||||
@@ -2,14 +2,14 @@
|
|||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Eiswurm\NossenerlandImportBundle\Contao\Manager;
|
namespace Mummert\NossenerlandImportBundle\Contao\Manager;
|
||||||
|
|
||||||
use Contao\CalendarBundle\ContaoCalendarBundle;
|
use Contao\CalendarBundle\ContaoCalendarBundle;
|
||||||
use Contao\CoreBundle\ContaoCoreBundle;
|
use Contao\CoreBundle\ContaoCoreBundle;
|
||||||
use Contao\ManagerPlugin\Bundle\BundlePluginInterface;
|
use Contao\ManagerPlugin\Bundle\BundlePluginInterface;
|
||||||
use Contao\ManagerPlugin\Bundle\Config\BundleConfig;
|
use Contao\ManagerPlugin\Bundle\Config\BundleConfig;
|
||||||
use Contao\ManagerPlugin\Bundle\Parser\ParserInterface;
|
use Contao\ManagerPlugin\Bundle\Parser\ParserInterface;
|
||||||
use Eiswurm\NossenerlandImportBundle\NossenerlandImportBundle;
|
use Mummert\NossenerlandImportBundle\NossenerlandImportBundle;
|
||||||
|
|
||||||
class Plugin implements BundlePluginInterface
|
class Plugin implements BundlePluginInterface
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Eiswurm\NossenerlandImportBundle\DependencyInjection;
|
namespace Mummert\NossenerlandImportBundle\DependencyInjection;
|
||||||
|
|
||||||
use Symfony\Component\Config\FileLocator;
|
use Symfony\Component\Config\FileLocator;
|
||||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Eiswurm\NossenerlandImportBundle;
|
namespace Mummert\NossenerlandImportBundle;
|
||||||
|
|
||||||
use Symfony\Component\HttpKernel\Bundle\Bundle;
|
use Symfony\Component\HttpKernel\Bundle\Bundle;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user