Add EVLKS accessibility field and export mapping
This commit is contained in:
@@ -12,6 +12,7 @@ class ExportEventsCommand extends Command
|
||||
{
|
||||
private $connection;
|
||||
private $soapClientService;
|
||||
private const BATCH_SIZE = 200;
|
||||
|
||||
public function __construct(Connection $connection, SoapClientService $soapClientService)
|
||||
{
|
||||
@@ -29,21 +30,35 @@ class ExportEventsCommand extends Command
|
||||
{
|
||||
$today = (new \DateTimeImmutable('today'))->getTimestamp();
|
||||
|
||||
$stmt = $this->connection->executeQuery(
|
||||
'SELECT * FROM tl_calendar_events WHERE pid IN (1, 2, 3) AND evlkscalendar != 1 AND (
|
||||
(endDate IS NOT NULL AND endDate >= ?) OR (endDate IS NULL AND startDate >= ?)
|
||||
)',
|
||||
[$today, $today]
|
||||
);
|
||||
|
||||
$exportedIds = [];
|
||||
$exportCount = 0;
|
||||
|
||||
while ($event = $stmt->fetchAssociative()) {
|
||||
$response = $this->soapClientService->sendEventToSoapAPI($event);
|
||||
if ($response) {
|
||||
$exportedIds[] = (string) $event['id'];
|
||||
$exportCount++;
|
||||
$lastId = 0;
|
||||
|
||||
while (true) {
|
||||
$rows = $this->connection->executeQuery(
|
||||
'SELECT * FROM tl_calendar_events
|
||||
WHERE pid IN (1, 2, 3)
|
||||
AND evlkscalendar != 1
|
||||
AND ((endDate IS NOT NULL AND endDate >= ?) OR (endDate IS NULL AND startDate >= ?))
|
||||
AND id > ?
|
||||
ORDER BY id ASC
|
||||
LIMIT ' . self::BATCH_SIZE,
|
||||
[$today, $today, $lastId]
|
||||
)->fetchAllAssociative();
|
||||
|
||||
if (empty($rows)) {
|
||||
break;
|
||||
}
|
||||
|
||||
foreach ($rows as $event) {
|
||||
$response = $this->soapClientService->sendEventToSoapAPI($event);
|
||||
if ($response) {
|
||||
$exportedIds[] = (string) $event['id'];
|
||||
$exportCount++;
|
||||
}
|
||||
|
||||
$lastId = (int) $event['id'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user