public function execute(InputInterface $input, OutputInterface $output) { $man = AbstractApp::get('elastic2'); /* @var $man ElasticSearch2 */ $list = $man->listIndexes($output); foreach ($list as $name) { $output->writeln("index: {$name}"); } }
public function execute(InputInterface $input, OutputInterface $output) { $man = AbstractApp::get('elastic2'); /* @var $man ElasticSearch2 */ $host = $this->getContainer()->getParameter('elastic.host'); $output->writeln("<info>Server: {$host}</info>"); $helper = $this->getHelper('question'); $question = new ConfirmationQuestion("Target server is: <info>{$host}</info>, do you want to continue? (y|n) : ", false, '/^(y|j)/i'); if ($input->getOption('force') || $helper->ask($input, $output, $question)) { $man->populate($input->getOption('index'), $output); } else { $output->writeln("Aborted"); } }
/** * @param InputInterface $input * @param OutputInterface $output * @param string|array $em */ protected function init(InputInterface $input, OutputInterface $output, $em = null) { $this->input = $input; $this->output = $output; if ($em === false) { return; } if ($em === true) { $em = 'default'; } if (is_null($em)) { throw new Exception("Ustaw najpierw parametr 'em' np: 'old' lub ustaw wartość 'true' aby wybrać domyślny manager. " . __METHOD__); } if (is_string($em)) { $this->em = AbstractApp::get("doctrine.orm.{$em}_entity_manager"); $this->dbal = $this->em->getConnection(); } if (is_array($em)) { $this->em = array(); $this->dbal = array(); foreach ($em as $d) { $this->em[$d] = AbstractApp::get("doctrine.orm.{$d}_entity_manager"); $this->dbal[$d] = $this->em[$d]->getConnection(); } } /* * Przestawiam domyślny język */ // try { // // niechginiee('opt'); // // niechginie($input->getOption('lang')); // if ($lang = $input->getOption('lang')) // $this->getContainer()->parameters['locale'] = $lang; // } // catch (InvalidArgumentException $e) { // if (strpos($e->getMessage(), ' option does not exist') !== false) { // echo $e->getMessage().PHP_EOL; // die(" // Trzeba pdmienić ścieżkę do klasy w app/console z: // use Symfony\Bundle\FrameworkBundle\Console\Application; // na: // use Cms\BaseBundle\Classes\Application; // "); // } // } }
public function getService($name) { // $service = $this->container->get(UtilArray::cascadeGet($tdata, 'mapping.service')); return AbstractApp::get($name); }
public function execute(InputInterface $input, OutputInterface $output) { $man = AbstractApp::get('elastic2'); /* @var $man ElasticSearch2 */ $man->delete($input->getOption('index'), $input->getOption('type'), $input->getOption('id'), $output); }
/** * Podawać tylko dla dbal. * * @param false|EntityManager $em */ public function __construct($em = null) { if (is_string($em)) { $em = AbstractApp::get($em); if ($em instanceof Connection) { $em = EntityManager::create($em, Setup::createAnnotationMetadataConfiguration(array(), false)); } } $this->setEM($em); }