mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-04 22:04:59 +00:00
resolving deprecated private service injection on commands classes
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
<?php
|
||||
namespace Chill\MainBundle\Command;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Intl\Intl;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
@@ -11,9 +12,29 @@ use Symfony\Component\Console\Output\OutputInterface;
|
||||
* @author Julien Fastré <julien.fastre@champs-libres.coop
|
||||
*
|
||||
*/
|
||||
class LoadCountriesCommand extends ContainerAwareCommand
|
||||
class LoadCountriesCommand extends Command
|
||||
{
|
||||
|
||||
/**
|
||||
* @var EntityManager
|
||||
*/
|
||||
private $entityManager;
|
||||
|
||||
private $availableLanguages;
|
||||
|
||||
/**
|
||||
* LoadCountriesCommand constructor.
|
||||
*
|
||||
* @param EntityManager $entityManager
|
||||
* @param $availableLanguages
|
||||
*/
|
||||
public function __construct(EntityManager $entityManager, $availableLanguages)
|
||||
{
|
||||
$this->entityManager=$entityManager;
|
||||
$this->availableLanguages=$availableLanguages;
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-PHPdoc)
|
||||
* @see \Symfony\Component\Console\Command\Command::configure()
|
||||
@@ -31,8 +52,8 @@ class LoadCountriesCommand extends ContainerAwareCommand
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$countries = static::prepareCountryList($this->getContainer()->getParameter('chill_main.available_languages'));
|
||||
$em = $this->getContainer()->get('doctrine.orm.entity_manager');
|
||||
$countries = static::prepareCountryList($this->availableLanguages);
|
||||
$em = $this->entityManager;
|
||||
|
||||
foreach($countries as $country) {
|
||||
$countryStored = $em->getRepository('ChillMainBundle:Country')
|
||||
|
Reference in New Issue
Block a user