/** * Initialize Connections * @param InputInterface $input input * @param OutputInterface $output output */ protected function initialize(InputInterface $input, OutputInterface $output) { parent::initialize($input, $output); $this->container = $this->getContainer(); $this->classification = $this->container->get('consult.classification'); $this->wordManager = $this->container->get('consult.word_manager'); }
/** * Initializes the command just after the input has been validated. * * This is mainly useful when a lot of commands extends one main command * where some things need to be initialized based on the input arguments and options. * * @param InputInterface $input An InputInterface instance * @param OutputInterface $output An OutputInterface instance */ protected function initialize(InputInterface $input, OutputInterface $output) { parent::initialize($input, $output); $this->helper = $this->getHelperSet()->get('formatter'); // $this->rootDir = $this->getContainer()->get('kernel')->getRootDir(); // $this->env = $this->getContainer()->get('kernel')->getEnvironment(); }
protected function initialize(InputInterface $input, OutputInterface $output) { parent::initialize($input, $output); $this->communicationService = $this->getContainer()->get(CommunicationService::ID); $this->documentManager = $this->getContainer()->get('doctrine_mongodb')->getManager(); $this->eventDispatcher = $this->getContainer()->get('event_dispatcher'); }
protected function initialize(InputInterface $input, OutputInterface $output) { parent::initialize($input, $output); $this->basePath = $input->getArgument('write_to') ?: $this->getContainer()->getParameter('assetic.write_to'); $this->verbose = $input->getOption('verbose'); $this->am = $this->getContainer()->get('assetic.asset_manager'); }
protected function initialize(InputInterface $input, OutputInterface $output) { parent::initialize($input, $output); $this->targetPath = $input->getOption('target') ?: sprintf('%s/../web/js/fos_js_routes.js', $this->getContainer()->getParameter('kernel.root_dir')); $this->extractor = $this->getContainer()->get('fos_js_routing.extractor'); $this->serializer = $this->getContainer()->get('fos_js_routing.serializer'); }
/** * * @param InputInterface $input * @param OutputInterface $output * * @return void */ protected function initialize(InputInterface $input, OutputInterface $output) { parent::initialize($input, $output); declare (ticks=1); pcntl_signal(SIGTERM, [$this, 'stopCommand']); pcntl_signal(SIGINT, [$this, 'stopCommand']); }
/** * Initialize objects required by {@see execute()}. * * @param InputInterface $input * @param OutputInterface $output */ public function initialize(InputInterface $input, OutputInterface $output) { parent::initialize($input, $output); $this->searchIndexer = $this->getContainer()->get('ezpublish.spi.search.indexer'); if (!$this->searchIndexer instanceof Indexer) { throw new RuntimeException(sprintf('Expected to find Search Engine Indexer but found "%s" instead', get_parent_class($this->searchIndexer))); } }
/** * Initializes the command just after the input has been validated. * * This is mainly useful when a lot of commands extends one main command * where some things need to be initialized based on the input arguments and options. * * @param InputInterface $input An InputInterface instance * @param OutputInterface $output An OutputInterface instance */ protected function initialize(InputInterface $input, OutputInterface $output) { parent::initialize($input, $output); $this->entityManager = $this->getContainer()->get('doctrine.orm.default_entity_manager'); $this->router = $this->getContainer()->get('router.default'); $this->output = $output; $this->entityManager->getConnection()->getConfiguration()->setSQLLogger(null); }
/** * {@inheritdoc} */ protected function initialize(InputInterface $input, OutputInterface $output) { parent::initialize($input, $output); $this->checkConfiguration(); if ($input->hasArgument('bundle') && '@' === substr($input->getArgument('bundle'), 0, 1)) { $this->bundle = $this->getContainer()->get('kernel')->getBundle(substr($input->getArgument('bundle'), 1)); } }
/** * Initialize Connections * @param InputInterface $input input * @param OutputInterface $output output */ protected function initialize(InputInterface $input, OutputInterface $output) { parent::initialize($input, $output); //$this->container = $this->getContainer(); $this->queue = $this->getContainer()->get('consult.consult_queue'); $this->daaDebug = $this->getContainer()->getParameter('daa_debug'); $this->doctorManager = $this->getContainer()->get('consult.doctor_manager'); }
/** * @param InputInterface $input * @param OutputInterface $output */ protected function initialize(InputInterface $input, OutputInterface $output) { parent::initialize($input, $output); //initialize parent class method $this->container = $this->getContainer(); // This loads Doctrine, you can load your own services as well $this->em = $this->container->get('doctrine')->getManager(); }
/** * Initialize Services * * @param InputInterface $input - Input Interface * @param OutputInterface $output - Output Interface */ protected function initialize(InputInterface $input, OutputInterface $output) { parent::initialize($input, $output); $this->container = $this->getContainer(); $this->queue = $this->container->get('consult.consult_queue'); $this->helper = $this->container->get('consult.helper'); $this->doctorQuestionManager = $this->container->get('consult.doctorQuestionManager'); $this->questionManager = $this->container->get('consult.question_manager'); }
/** * {@inheritdoc} */ protected function initialize(InputInterface $input, OutputInterface $output) { parent::initialize($input, $output); $path = $this->getContainer()->getParameter('sb_event_queue.storage_path'); $this->process = new QueueProcess(); $this->process->setPath($path); if ($input->hasOption('name')) { $this->process->setQueueName($input->getOption('name')); } }
protected function initialize(InputInterface $input, OutputInterface $output) { $legacyRootDir = $this->getContainer()->getParameter('innomatic_legacy.root_dir'); $legacyScript = $input->getArgument('script'); // Check if the given script exists if (!file_exists($legacyRootDir . '/innomatic/core/scripts/' . $legacyScript)) { throw new \InvalidArgumentException(sprintf('The script "%s" does not exist.', $input->getArgument('script'))); } parent::initialize($input, $output); }
protected function initialize(InputInterface $input, OutputInterface $output) { parent::initialize($input, $output); $sets = $input->getOption('sets'); sort($sets); $sets_suffix = $sets ? '.' . join('_', $sets) : ''; $this->targetPath = $input->getOption('target') ?: sprintf('%s/../web/js/fos_js_routes' . $sets_suffix . '.js', $this->getContainer()->getParameter('kernel.root_dir')); $this->extractor = $this->getContainer()->get('fos_js_routing.extractor'); $this->serializer = $this->getContainer()->get('fos_js_routing.serializer'); }
/** * Initialize objects required by {@see execute()}. * * @param InputInterface $input * @param OutputInterface $output */ public function initialize(InputInterface $input, OutputInterface $output) { parent::initialize($input, $output); $this->logger = $this->getContainer()->get('logger'); $this->searchHandler = $this->getContainer()->get('ezpublish.spi.search'); $this->persistenceHandler = $this->getContainer()->get('ezpublish.api.persistence_handler'); $this->databaseHandler = $this->getContainer()->get('ezpublish.connection'); if (!$this->searchHandler instanceof SearchHandler) { throw new RuntimeException('Expected to find Legacy Search Engine but found something else.' . "Did you forget to configure the repository with 'legacy' search engine?"); } }
/** * {@inheritdoc} */ protected function initialize(InputInterface $input, OutputInterface $output) { parent::initialize($input, $output); $this->io = new SymfonyStyle($input, $output); $connectionName = 'mongo.connection'; if ($input->getOption('connection')) { $connectionName .= '.' . $input->getOption('connection'); } if (!$this->getContainer()->has($connectionName)) { throw new \LogicException(sprintf('No connection named \'%s\' found', $input->getOption('connection'))); } $this->connection = $this->getContainer()->get($connectionName); }
/** * Initialises the features of this class. This function should be called explicitly (i.e. parent::initialize()) * if the initialize function is overridden. * * @param InputInterface $input * @param OutputInterface $output * * @throws \Exception * @throws BaseCommandException * @throws LockAcquireException */ protected function initialize(InputInterface $input, OutputInterface $output) { try { $this->getRuntimeConfig()->loadGlobalConfigFromContainer($this->getContainer()); $this->advanceExecutionPhase(RuntimeConfig::PHASE_LOAD_PARAMETERS); $this->getRuntimeConfig()->loadConfigFromCommandParameters($input); $this->advanceExecutionPhase(RuntimeConfig::PHASE_INITIALISE); parent::initialize($input, $output); $this->getLoggingEnhancement()->initialize($input, $output); $this->getLockingEnhancement()->initialize($input, $output); // Override production settings of not showing errors error_reporting(E_ALL); $this->setDisplayErrors(true); // PHP Memory Limit: if ($this->getMemoryLimit() !== null) { $this->setMemoryLimit($this->getMemoryLimit()); } $this->advanceExecutionPhase(RuntimeConfig::PHASE_POST_INITIALISE); } catch (\Exception $e) { $this->getRuntimeConfig()->advanceExecutionPhase(RuntimeConfig::PHASE_INITIALIZE_FAILED); throw $e; } }
/** * @inheritdoc */ protected function initialize(InputInterface $input, OutputInterface $output) { parent::initialize($input, $output); DoctrineCommandHelper::setApplicationConnection($this->getApplication(), null); }
/** * Initialises the features of this class. This function should be called explicitly (i.e. parent::initialize()) * if the initialize function is overridden. * * @param InputInterface $input * @param OutputInterface $output * * @throws \Exception * @throws BaseCommandException */ protected function initialize(InputInterface $input, OutputInterface $output) { $this->getRuntimeConfig()->loadGlobalConfigFromContainer($this->getContainer()); $this->advanceExecutionPhase(RuntimeConfig::PHASE_LOAD_PARAMETERS); $this->getRuntimeConfig()->loadConfigFromCommandParameters($input); $this->advanceExecutionPhase(RuntimeConfig::PHASE_INITIALISE); parent::initialize($input, $output); $this->getLoggingEnhancement()->initialize($input, $output); $this->validate($input, $output); // Reflect to get leaf-class: if (empty($this->filename)) { $reflectionClass = new \ReflectionClass($this); $this->filename = basename($reflectionClass->getFileName()); } // Lock handler: if ($input->getOption('locking') !== 'off') { if ($input->getOption('locking') == 'on' || $this->isLocking()) { $this->lockHandler = new LockHandler($this->filename, $this->getLockFileFolder()); if (!$this->lockHandler->lock()) { throw new LockAcquireException('Sorry, can\'t get the lock. Bailing out!'); } // TODO Decide on output option here (possibly option to log instead of polluting STDOUT) //$output->writeln('<info>LOCK Acquired</info>'); } } // Override production settings of not showing errors error_reporting(E_ALL); $this->setDisplayErrors(true); // PHP Memory Limit: if ($this->getMemoryLimit() !== null) { $this->setMemoryLimit($this->getMemoryLimit()); } $this->advanceExecutionPhase(RuntimeConfig::PHASE_POST_INITIALISE); }
/** * @param InputInterface $input * @param OutputInterface $output */ protected function initialize(InputInterface $input, OutputInterface $output) { parent::initialize($input, $output); $this->em = $this->getContainer()->get('doctrine')->getManager(); }
/** * Initializes the command just after the input has been validated. * * This is mainly useful when a lot of commands extends one main command * where some things need to be initialized based on the input arguments and options. * * @param InputInterface $input An InputInterface instance * @param OutputInterface $output An OutputInterface instance */ protected function initialize(InputInterface $input, OutputInterface $output) { parent::initialize($input, $output); $this->entityManager = $this->getContainer()->get('doctrine.orm.entity_manager'); $this->output = $output; }
/** * @param InputInterface $input * @param OutputInterface $output */ protected function initialize(InputInterface $input, OutputInterface $output) { parent::initialize($input, $output); $this->verbose = $input->getOption('verbose'); }
/** * @param InputInterface $input * @param OutputInterface $output */ protected function initialize(InputInterface $input, OutputInterface $output) { parent::initialize($input, $output); $this->container = $this->getContainer(); }
protected function initialize(InputInterface $input, OutputInterface $output) { parent::initialize($input, $output); }
/** * {@inheritdoc} */ protected function initialize(InputInterface $input, OutputInterface $output) { parent::initialize($input, $output); $this->checkConfiguration(); }
/** * Initialize Queue * @param InputInterface $input input * @param OutputInterface $output output */ protected function initialize(InputInterface $input, OutputInterface $output) { parent::initialize($input, $output); $this->container = $this->getContainer(); $this->queue = $this->container->get('consult.consult_queue'); }
/** * {@inheritDoc} */ protected function initialize(InputInterface $input, OutputInterface $output) { parent::initialize($input, $output); $this->targetPath = $input->getArgument('target') ?: sprintf('%s/../web/js', $this->getContainer()->getParameter('kernel.root_dir')); }
protected function initialize(InputInterface $input, OutputInterface $output) { parent::initialize($input, $output); $this->repository = $this->getContainer()->get('routing.repository'); $this->provider = $this->getContainer()->get('router.provider.endpoint'); }