mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-03 21:34:59 +00:00
resolving deprecated private service injection on commands classes
This commit is contained in:
@@ -19,7 +19,8 @@
|
||||
|
||||
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\Input\InputOption;
|
||||
@@ -28,8 +29,16 @@ use Symfony\Component\Console\Output\OutputInterface;
|
||||
/*
|
||||
* Load or update the languages entities command
|
||||
*/
|
||||
class LoadAndUpdateLanguagesCommand extends ContainerAwareCommand
|
||||
class LoadAndUpdateLanguagesCommand extends Command
|
||||
{
|
||||
|
||||
/**
|
||||
* @var EntityManager
|
||||
*/
|
||||
private $entityManager;
|
||||
|
||||
private $availableLanguages;
|
||||
|
||||
// The regional version of language are language with _ in the code
|
||||
// This array contains regional code to not exclude
|
||||
private $regionalVersionToInclude = ["ro_MD"];
|
||||
@@ -40,7 +49,21 @@ class LoadAndUpdateLanguagesCommand extends ContainerAwareCommand
|
||||
|
||||
const INCLUDE_REGIONAL_VERSION = 'include_regional';
|
||||
const INCLUDE_ANCIENT = 'include_ancient';
|
||||
|
||||
|
||||
/**
|
||||
* 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()
|
||||
@@ -72,8 +95,8 @@ class LoadAndUpdateLanguagesCommand extends ContainerAwareCommand
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$em = $this->getContainer()->get('doctrine.orm.entity_manager');
|
||||
$chillAvailableLanguages = $this->getContainer()->getParameter('chill_main.available_languages');
|
||||
$em = $this->entityManager;
|
||||
$chillAvailableLanguages = $this->availableLanguages;
|
||||
$languageBundle = Intl::getLanguageBundle();
|
||||
$languages = array();
|
||||
|
||||
|
Reference in New Issue
Block a user