--since=<Zeitpunkt> schränkt den Quell-Scan auf Legacy-Zeilen ein, deren created_at ODER updated_at im Fenster liegt (users/companies/contacts/ press-releases; Kategorien und link-associations bleiben ungefiltert). Kombiniert mit --force werden geänderte Bestandszeilen aktualisiert — damit dauert ein Tages-Delta Sekunden statt eines Volldurchlaufs über 150k+ Zeilen. Dazu Bugfix, der den Delta erst rund macht: User-/Company-/Contact- Importer übergaben created_at/updated_at innerhalb von updateOrCreate — die Felder sind nicht fillable und wurden stillschweigend verworfen (Live-Befund: NULL-Timestamps, bisher nur durch legacy:fix-timestamps geheilt). Jetzt explizit per forceFill wie im PressReleaseImporter. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
44 lines
1.3 KiB
PHP
44 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Services\Import;
|
|
|
|
use App\Enums\Portal;
|
|
use Illuminate\Support\Carbon;
|
|
|
|
/**
|
|
* Hält den Kontext für einen Import-Lauf.
|
|
*
|
|
* `since` schränkt den Quell-Scan auf Legacy-Zeilen ein, deren
|
|
* created_at ODER updated_at ab dem Stichtag liegt (Delta-Läufe) —
|
|
* Kategorien und link-associations bleiben davon unberührt.
|
|
*/
|
|
final class ImportContext
|
|
{
|
|
public readonly ?Portal $portalEnum;
|
|
|
|
public readonly ?string $connection;
|
|
|
|
public function __construct(
|
|
public readonly string $portal, // 'presseecho' | 'businessportal24' | 'all'
|
|
public readonly bool $dryRun = false,
|
|
public readonly bool $force = false,
|
|
public readonly ?Carbon $since = null,
|
|
) {
|
|
if ($portal === 'all') {
|
|
$this->portalEnum = null;
|
|
$this->connection = null;
|
|
} else {
|
|
$this->portalEnum = Portal::from($portal);
|
|
$this->connection = match ($portal) {
|
|
'presseecho' => 'mysql_presseecho',
|
|
'businessportal24' => 'mysql_businessportal',
|
|
default => throw new \InvalidArgumentException("Unbekanntes Portal: {$portal}"),
|
|
};
|
|
}
|
|
}
|
|
|
|
public function legacyPortalValue(): string
|
|
{
|
|
return $this->portal;
|
|
}
|
|
}
|