mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 13:24:25 +00:00
Simplify loading of Symfony commands.
This commit is contained in:
parent
ca9ae3874c
commit
5ddc0e7a53
@ -1,25 +1,7 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2016-2019 Champs-Libres <info@champs-libres.coop>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace Chill\PersonBundle\Command;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
@ -28,26 +10,15 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Symfony\Component\Console\Exception\RuntimeException;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
|
||||
class ChillPersonMoveCommand extends ContainerAwareCommand
|
||||
final class ChillPersonMoveCommand extends Command
|
||||
{
|
||||
/**
|
||||
*
|
||||
* @var PersonMove
|
||||
*/
|
||||
protected $mover;
|
||||
private PersonMove $mover;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var EntityManagerInterface
|
||||
*/
|
||||
protected $em;
|
||||
private EntityManagerInterface $em;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var LoggerInterface
|
||||
*/
|
||||
protected $chillLogger;
|
||||
private LoggerInterface $chillLogger;
|
||||
|
||||
public function __construct(
|
||||
PersonMove $mover,
|
||||
|
@ -1,22 +1,5 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Copyright (C) 2016 Champs-Libres <info@champs-libres.coop>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace Chill\PersonBundle\Command;
|
||||
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||
@ -40,61 +23,33 @@ use Symfony\Component\Console\Question\ConfirmationQuestion;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use Symfony\Component\EventDispatcher\Event;
|
||||
use Symfony\Component\Form\FormFactory;
|
||||
use Symfony\Component\Form\FormFactoryInterface;
|
||||
|
||||
/**
|
||||
* Class ImportPeopleFromCSVCommand
|
||||
*
|
||||
* @package Chill\PersonBundle\Command
|
||||
* @author Julien Fastré <julien.fastre@champs-libres.coop>
|
||||
*/
|
||||
class ImportPeopleFromCSVCommand extends Command
|
||||
final class ImportPeopleFromCSVCommand extends Command
|
||||
{
|
||||
/**
|
||||
* @var InputInterface
|
||||
*/
|
||||
protected $input;
|
||||
private InputInterface $input;
|
||||
|
||||
private OutputInterface $output;
|
||||
|
||||
private LoggerInterface $logger;
|
||||
|
||||
private TranslatableStringHelper $helper;
|
||||
|
||||
private EntityManagerInterface $em;
|
||||
|
||||
private EventDispatcherInterface $eventDispatcher;
|
||||
|
||||
/**
|
||||
* @var OutputInterface
|
||||
* The line currently read
|
||||
*/
|
||||
protected $output;
|
||||
private int $line;
|
||||
|
||||
/**
|
||||
* @var \Psr\Log\LoggerInterface
|
||||
* Where key are column names, and value the custom field slug
|
||||
*/
|
||||
protected $logger;
|
||||
private array $customFieldMapping = [];
|
||||
|
||||
/**
|
||||
* @var \Chill\MainBundle\Templating\TranslatableStringHelper
|
||||
*/
|
||||
protected $helper;
|
||||
|
||||
/**
|
||||
* @var \Doctrine\Persistence\ObjectManager
|
||||
*/
|
||||
protected $em;
|
||||
|
||||
/**
|
||||
* @var EventDispatcherInterface
|
||||
*/
|
||||
protected $eventDispatcher;
|
||||
|
||||
/**
|
||||
* the line currently read
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $line;
|
||||
|
||||
/**
|
||||
* @var array where key are column names, and value the custom field slug
|
||||
*/
|
||||
protected $customFieldMapping = array();
|
||||
|
||||
/**
|
||||
* @var CustomFieldProvider
|
||||
*/
|
||||
protected $customFieldProvider;
|
||||
private CustomFieldProvider $customFieldProvider;
|
||||
|
||||
/**
|
||||
* Contains an array of information searched in the file.
|
||||
@ -129,10 +84,7 @@ class ImportPeopleFromCSVCommand extends Command
|
||||
*/
|
||||
protected static $defaultDateInterpreter = "%d/%m/%Y|%e/%m/%y|%d/%m/%Y|%e/%m/%Y";
|
||||
|
||||
/**
|
||||
* @var FormFactory
|
||||
*/
|
||||
protected $formFactory;
|
||||
private FormFactoryInterface $formFactory;
|
||||
|
||||
/**
|
||||
* ImportPeopleFromCSVCommand constructor.
|
||||
@ -150,7 +102,7 @@ class ImportPeopleFromCSVCommand extends Command
|
||||
EntityManagerInterface $em,
|
||||
CustomFieldProvider $customFieldProvider,
|
||||
EventDispatcherInterface $eventDispatcher,
|
||||
FormFactory $formFactory
|
||||
FormFactoryInterface $formFactory
|
||||
) {
|
||||
$this->logger = $logger;
|
||||
$this->helper = $helper;
|
||||
|
@ -69,7 +69,6 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
|
||||
$loader->load('services/search.yaml');
|
||||
$loader->load('services/menu.yaml');
|
||||
$loader->load('services/privacyEvent.yaml');
|
||||
$loader->load('services/command.yaml');
|
||||
$loader->load('services/actions.yaml');
|
||||
$loader->load('services/form.yaml');
|
||||
$loader->load('services/alt_names.yaml');
|
||||
|
@ -12,6 +12,13 @@ services:
|
||||
tags:
|
||||
- { name: 'serializer.normalizer', priority: 64 }
|
||||
|
||||
Chill\PersonBundle\Command\:
|
||||
resource: '../Command/'
|
||||
autowire: true
|
||||
autoconfigure: true
|
||||
tags:
|
||||
- { name: console.command }
|
||||
|
||||
chill.person.form.type.select2maritalstatus:
|
||||
class: Chill\PersonBundle\Form\Type\Select2MaritalStatusType
|
||||
arguments:
|
||||
|
@ -1,19 +0,0 @@
|
||||
services:
|
||||
Chill\PersonBundle\Command\ChillPersonMoveCommand:
|
||||
arguments:
|
||||
$em: '@Doctrine\ORM\EntityManagerInterface'
|
||||
$mover: '@Chill\PersonBundle\Actions\Remove\PersonMove'
|
||||
$chillLogger: '@chill.main.logger'
|
||||
tags:
|
||||
- { name: console.command }
|
||||
|
||||
Chill\PersonBundle\Command\ImportPeopleFromCSVCommand:
|
||||
arguments:
|
||||
$logger: '@logger'
|
||||
$helper: '@Chill\MainBundle\Templating\TranslatableStringHelper'
|
||||
$em: '@Doctrine\ORM\EntityManagerInterface'
|
||||
$customFieldProvider: '@Chill\CustomFieldsBundle\Service\CustomFieldProvider'
|
||||
$eventDispatcher: '@Symfony\Component\EventDispatcher\EventDispatcherInterface'
|
||||
$formFactory: '@form.factory'
|
||||
tags:
|
||||
- { name: console.command }
|
Loading…
x
Reference in New Issue
Block a user