mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
resolving deprecated private service injection on commands classes
This commit is contained in:
parent
a0d36b8d78
commit
f63c4b42e0
@ -19,7 +19,10 @@
|
||||
|
||||
namespace Chill\PersonBundle\Command;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
@ -36,6 +39,7 @@ use Chill\CustomFieldsBundle\Service\CustomFieldProvider;
|
||||
use Symfony\Component\Console\Question\ConfirmationQuestion;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use Symfony\Component\EventDispatcher\Event;
|
||||
use Symfony\Component\Form\FormFactory;
|
||||
|
||||
/**
|
||||
* Class ImportPeopleFromCSVCommand
|
||||
@ -43,7 +47,7 @@ use Symfony\Component\EventDispatcher\Event;
|
||||
* @package Chill\PersonBundle\Command
|
||||
* @author Julien Fastré <julien.fastre@champs-libres.coop>
|
||||
*/
|
||||
class ImportPeopleFromCSVCommand extends ContainerAwareCommand
|
||||
class ImportPeopleFromCSVCommand extends Command
|
||||
{
|
||||
/**
|
||||
* @var InputInterface
|
||||
@ -124,19 +128,36 @@ class ImportPeopleFromCSVCommand extends ContainerAwareCommand
|
||||
* @var string
|
||||
*/
|
||||
protected static $defaultDateInterpreter = "%d/%m/%Y|%e/%m/%y|%d/%m/%Y|%e/%m/%Y";
|
||||
|
||||
|
||||
/**
|
||||
* @var FormFactory
|
||||
*/
|
||||
protected $formFactory;
|
||||
|
||||
/**
|
||||
* ImportPeopleFromCSVCommand constructor.
|
||||
*
|
||||
* @param LoggerInterface $logger
|
||||
* @param TranslatableStringHelper $helper
|
||||
* @param EntityManagerInterface $em
|
||||
* @param CustomFieldProvider $customFieldProvider
|
||||
* @param EventDispatcherInterface $eventDispatcher
|
||||
* @param FormFactory $formFactory
|
||||
*/
|
||||
public function __construct(
|
||||
\Psr\Log\LoggerInterface $logger,
|
||||
\Chill\MainBundle\Templating\TranslatableStringHelper $helper,
|
||||
\Doctrine\ORM\EntityManagerInterface $em,
|
||||
LoggerInterface $logger,
|
||||
TranslatableStringHelper $helper,
|
||||
EntityManagerInterface $em,
|
||||
CustomFieldProvider $customFieldProvider,
|
||||
EventDispatcherInterface $eventDispatcher
|
||||
EventDispatcherInterface $eventDispatcher,
|
||||
FormFactory $formFactory
|
||||
) {
|
||||
$this->logger = $logger;
|
||||
$this->helper = $helper;
|
||||
$this->em = $em;
|
||||
$this->customFieldProvider = $customFieldProvider;
|
||||
$this->eventDispatcher = $eventDispatcher;
|
||||
$this->formFactory = $formFactory;
|
||||
|
||||
parent::__construct('chill:person:import');
|
||||
}
|
||||
@ -393,9 +414,6 @@ EOF
|
||||
$this->logger->debug("Setting locale to ".$input->getArgument('locale'));
|
||||
setlocale(LC_TIME, $input->getArgument('locale'));
|
||||
|
||||
/* @var $em \Doctrine\Persistence\ObjectManager */
|
||||
$this->em = $this->getContainer()->get('doctrine.orm.entity_manager');
|
||||
|
||||
// opening csv as resource
|
||||
$csv = $this->openCSV();
|
||||
|
||||
@ -857,15 +875,14 @@ EOF
|
||||
*/
|
||||
protected function processingCustomFields(Person $person, $row)
|
||||
{
|
||||
/* @var $factory \Symfony\Component\Form\FormFactory */
|
||||
$factory = $this->getContainer()->get('form.factory');
|
||||
|
||||
/* @var $cfProvider \Chill\CustomFieldsBundle\Service\CustomFieldProvider */
|
||||
$cfProvider = $this->customFieldProvider;
|
||||
$cfData = array();
|
||||
|
||||
/* @var $$customField \Chill\CustomFieldsBundle\Entity\CustomField */
|
||||
foreach($this->customFieldMapping as $rowNumber => $customField) {
|
||||
$builder = $factory->createBuilder();
|
||||
$builder = $this->formFactory->createBuilder();
|
||||
$cfProvider->getCustomFieldByType($customField->getType())
|
||||
->buildForm($builder, $customField);
|
||||
$form = $builder->getForm();
|
||||
|
@ -1,14 +1,4 @@
|
||||
services:
|
||||
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'
|
||||
tags:
|
||||
- { name: console.command }
|
||||
|
||||
Chill\PersonBundle\Command\ChillPersonMoveCommand:
|
||||
arguments:
|
||||
$em: '@Doctrine\ORM\EntityManagerInterface'
|
||||
@ -16,3 +6,14 @@ services:
|
||||
$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