remove unused sync commands (app:sync-actors, app:sync-films)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,37 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Command;
|
|
||||||
|
|
||||||
use App\Entity\Movie;
|
|
||||||
use App\Exception\GatewayException;
|
|
||||||
use App\Service\ActorSyncer;
|
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
|
||||||
use Symfony\Component\Console\Attribute\AsCommand;
|
|
||||||
use Symfony\Component\Console\Command\Command;
|
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
|
||||||
|
|
||||||
#[AsCommand('app:sync-actors')]
|
|
||||||
readonly class SyncActorsCommand
|
|
||||||
{
|
|
||||||
public function __construct(
|
|
||||||
private ActorSyncer $actorSyncer,
|
|
||||||
private EntityManagerInterface $em,
|
|
||||||
) {}
|
|
||||||
|
|
||||||
public function __invoke(OutputInterface $output): int
|
|
||||||
{
|
|
||||||
foreach ($this->em->getRepository(Movie::class)->findAll() as $film) {
|
|
||||||
try {
|
|
||||||
$output->writeln('Syncing cast for '.$film->getTitle());
|
|
||||||
$this->actorSyncer->syncActorsForMovie($film);
|
|
||||||
} catch (GatewayException $e) {
|
|
||||||
$output->writeln('/!\ '.$e->getMessage());
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->em->flush();
|
|
||||||
}
|
|
||||||
|
|
||||||
return Command::SUCCESS;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,57 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Command;
|
|
||||||
|
|
||||||
use App\Exception\GatewayException;
|
|
||||||
use App\Gateway\LtbxdGateway;
|
|
||||||
use App\Service\FilmImporter;
|
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
|
||||||
use Symfony\Component\Console\Attribute\AsCommand;
|
|
||||||
use Symfony\Component\Console\Command\Command;
|
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
|
||||||
|
|
||||||
#[AsCommand('app:sync-films')]
|
|
||||||
readonly class SyncFilmsCommands
|
|
||||||
{
|
|
||||||
public function __construct(
|
|
||||||
private LtbxdGateway $ltbxdGateway,
|
|
||||||
private FilmImporter $filmImporter,
|
|
||||||
private EntityManagerInterface $em,
|
|
||||||
) {}
|
|
||||||
|
|
||||||
public function __invoke(OutputInterface $output): int
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
$ltbxdMovies = $this->ltbxdGateway->parseFile();
|
|
||||||
} catch (GatewayException $e) {
|
|
||||||
$output->writeln('/!\ '.$e->getMessage());
|
|
||||||
|
|
||||||
return Command::FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
$i = 0;
|
|
||||||
foreach ($ltbxdMovies as $ltbxdMovie) {
|
|
||||||
try {
|
|
||||||
$movie = $this->filmImporter->importFromLtbxdMovie($ltbxdMovie);
|
|
||||||
if ($movie) {
|
|
||||||
$output->writeln('* Found '.$ltbxdMovie->getName());
|
|
||||||
}
|
|
||||||
} catch (GatewayException $e) {
|
|
||||||
$output->writeln('/!\ '.$e->getMessage());
|
|
||||||
|
|
||||||
return Command::FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
++$i;
|
|
||||||
if (0 === $i % 50) {
|
|
||||||
$this->em->flush();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->em->flush();
|
|
||||||
|
|
||||||
$output->writeln('Films synced');
|
|
||||||
|
|
||||||
return Command::SUCCESS;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user