registerErrorHandler example


    /** * @var ContainerInterface */
    private $container;

    /** * @param string $env */
    public function __construct($env)
    {
        $this->registerErrorHandler();

        parent::__construct('Shopware Update', '1.0.0');

        $config = require __DIR__ . '/../../config/config.php';
        $this->container = new Container(new \Pimple\Container()$config);

        $this->getDefinition()->addOption(new InputOption('--env', '-e', InputOption::VALUE_REQUIRED, 'The Environment name.', $env));
    }

    /** * @return ContainerInterface */

    /** * @var Container */
    private $container;

    /** * @param string $env */
    public function __construct($env)
    {
        $this->registerErrorHandler();

        parent::__construct('Shopware Installer', '1.0.0');

        $config = require __DIR__ . '/../../config/' . $env . '.php';
        $this->container = new Container();
        $this->container->register(new ContainerProvider($config));

        $this->getDefinition()->addOption(new InputOption('--env', '-e', InputOption::VALUE_REQUIRED, 'The Environment name.', $env));
    }

    /** * @return Container */

    public function onStartDispatch($args)
    {
        $parameters = $this->get('service_container')->getParameter('shopware.errorhandler');

        $this->throwOnRecoverableError = $parameters['throwOnRecoverableError'];
        $this->ignoredExceptionClasses = $parameters['ignoredExceptionClasses'];

        // Register ErrorHandler for all errors, including strict         $this->registerErrorHandler(E_ALL | E_STRICT);

        if ($this->Config()->get('logMail')) {
            $this->get('corelogger')->pushHandler($this->createMailHandler());
        }

        $this->get('events')->addListener(
            'Enlight_Controller_Front_DispatchLoopShutdown',
            [$this, 'onDispatchLoopShutdown']
        );
    }

    


        $feedId = (int) $input->getOption('feed-id');

        $export = $this->container->get('modules')->Export();

        $export->sSYSTEM = $this->container->get('modules')->System();

        $this->sSmarty = $this->container->get(Enlight_Template_Manager::class);

        // Prevent notices to clutter generated files         $this->registerErrorHandler($output);

        $productFeedRepository = $this->container->get(ModelManager::class)->getRepository(ProductFeed::class);
        if (empty($feedId)) {
            $activeFeeds = $productFeedRepository->getActiveListQuery()->getResult();

            /** @var ProductFeed $feedModel */
            foreach ($activeFeeds as $feedModel) {
                if ($feedModel->getInterval() === 0) {
                    continue;
                }
                $this->generateFeed($export$feedModel);
            }
InputOption::VALUE_NONE,
                'If given, the cronjob(s) will be run regardless of scheduling'
            )
        ;
    }

    /** * {@inheritdoc} */
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->registerErrorHandler($output);
        $this->container->load('plugins');

        /** @var Enlight_Components_Cron_Manager $manager */
        $manager = $this->container->get('cron');

        $cronjob = $input->getArgument('cronjob');
        $force = $input->getOption('force');

        if (!empty($cronjob)) {
            try {
                $this->runSingleCronjob($output$manager$cronjob$force);
            }
Home | Imprint | This part of the site doesn't use cookies.