Commit 1da398ae authored by Stephane Bouvry's avatar Stephane Bouvry
Browse files

Suppression de la commande 'activity:search:rebuild' (remplacée par la...

Suppression de la commande 'activity:search:rebuild' (remplacée par la commande 'activity:search:reindex')
parent 840db4d0
Loading
Loading
Loading
Loading
+0 −70
Changes for module/Oscar/src/Oscar/Command/OscarActivitySearchRebuildCommand.php: 0 added lines, 70 removed lines.
Original line number Diff line number Diff line
<?php
/**
 * Created by PhpStorm.
 * User: bouvry
 * Date: 04/10/19
 * Time: 11:49
 */

namespace Oscar\Command;


use Moment\Moment;
use Oscar\Connector\ConnectorRepport;
use Oscar\Entity\Authentification;
use Oscar\Entity\LogActivity;
use Oscar\Entity\Person;
use Oscar\Entity\Role;
use Oscar\Service\ConnectorService;
use Oscar\Service\OrganizationService;
use Oscar\Service\OscarConfigurationService;
use Oscar\Service\OscarUserContext;
use Oscar\Service\PersonService;
use Oscar\Service\ProjectGrantService;
use Symfony\Component\Console\Helper\Table;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;

class OscarActivitySearchRebuildCommand extends OscarCommandAbstract
{
    protected static $defaultName = 'activity:search-rebuild';

    protected function configure()
    {
        $this
            ->setDescription("Reconstruction de l'index de recherche des activités")
        ;
    }

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->addOutputStyle($output);

        /** @var OscarUserContext $oscaruserContext */
        $oscaruserContext = $this->getServicemanager()->get(OscarUserContext::class);

        $io = new SymfonyStyle($input, $output);

        $io->title("Reconstruction de l'index de recherche des activités");

        /** @var OscarConfigurationService $oscarConfig */
        $oscarConfig = $this->getServicemanager()->get(OscarConfigurationService::class);

        /** @var ProjectGrantService $projectGrantService */
        $projectGrantService = $this->getServicemanager()->get(ProjectGrantService::class);

        try {
            /** @var ConnectorRepport $repport */
           $repport = $projectGrantService->searchIndex_rebuild();
            $io->success(sprintf('Index de recherche mis à jour avec %s activité(s) indexée(s)', count($repport->getAdded())));


        } catch (\Exception $e ){
            $io->error($e->getMessage() . "\n" . $e->getTraceAsString());
        }
    }
}
 No newline at end of file