public function runCallback(\Closure $callback)
    {
        // Check if a legacy stack callback is already running.
        if ($this->runningCallback) {
            throw new RuntimeException('Started recursive callback in legacy kernel.');
        }

        // Set the callback as running.
        $this->runningCallback = true;

        // Change current directory to the legacy stack.
        $platformHome = getcwd();
        // @todo Must get innomatic_legacy path from configuration.
        chdir($platformHome . '/innomatic_legacy');

        try {
            // Start the legacy Root Container and the legacy autoloader.
            require_once getcwd().'/innomatic/core/classes/innomatic/core/RootContainer.php';
            $rootContainer = \Innomatic\Core\RootContainer::instance('\Innomatic\Core\RootContainer');

            // Add the Symfony service container
            $rootContainer->setServiceContainer($this->container);

            // Start the legacy Innomatic Container.
            $innomatic = \Innomatic\Core\InnomaticContainer::instance('\Innomatic\Core\InnomaticContainer');

            // Set the Innomatic interface type to console.
            $innomatic->setInterface(\Innomatic\Core\InnomaticContainer::INTERFACE_CONSOLE);
            $home = \Innomatic\Core\RootContainer::instance('\Innomatic\Core\RootContainer')
                ->getHome()
                . 'innomatic/';

            // Start Innomatic.
            $innomatic->bootstrap($home, $home . 'core/conf/innomatic.ini');
            
            // Run the callback in the legacy core.
            $result = $innomatic->runCallback($callback);
        } catch (Exception $e) {
            // Go back to the new platform home.
            chdir($platformHome);
        
            // Clean the callback running state.
            $this->runningCallback = false;
            throw $e;
        }

        // Go back to the new platform home.
        chdir($platformHome);

        // Clean the callback running state.
        $this->runningCallback = false;

        return $result;
    }
public function runCallback(\Closure $callback)
    {
        // Check if a legacy stack callback is already running.
        if ($this->runningCallback) {
            throw new RuntimeException('Started recursive callback in legacy kernel.');
        }

        // Set the callback as running.
        $this->runningCallback = true;

        // Change current directory to the legacy stack.
        $platformHome = getcwd();
        // @todo Must get innomatic_legacy path from configuration.
        chdir($platformHome . '/innomatic_legacy');

        try {
            // Start the legacy Root Container and the legacy autoloader.
            require_once getcwd().'/innomatic/core/classes/innomatic/core/RootContainer.php';
            $rootContainer = \Innomatic\Core\RootContainer::instance('\Innomatic\Core\RootContainer');

            // Add the Symfony service container
            $rootContainer->setServiceContainer($this->container);

            // Start the legacy Innomatic Container.
            $innomatic = \Innomatic\Core\InnomaticContainer::instance('\Innomatic\Core\InnomaticContainer');

            // Set the Innomatic interface type to console.
            $innomatic->setInterface(\Innomatic\Core\InnomaticContainer::INTERFACE_CONSOLE);
            $home = \Innomatic\Core\RootContainer::instance('\Innomatic\Core\RootContainer')
                ->getHome()
                . 'innomatic/';

            // Start Innomatic.
            $innomatic->bootstrap($home, $home . 'core/conf/innomatic.ini');
            
            // Run the callback in the legacy core.
            $result = $innomatic->runCallback($callback);
        } catch (Exception $e) {
            // Go back to the new platform home.
            chdir($platformHome);
        
            // Clean the callback running state.
            $this->runningCallback = false;
            throw $e;
        }

        // Go back to the new platform home.
        chdir($platformHome);

        // Clean the callback running state.
        $this->runningCallback = false;

        return $result;
    }
public function runCallback ( \ Closure $ callback ) { // Check if a legacy stack callback is already running. if ( $ this -> runningCallback ) { throw new RuntimeException ( 'Started recursive callback in legacy kernel.' ) ; } // Set the callback as running. $ this -> runningCallback = true ; // Change current directory to the legacy stack. $ platformHome = getcwd ( ) ; // @todo Must get innomatic_legacy path from configuration. chdir ( $ platformHome . '/innomatic_legacy' ) ; try { // Start the legacy Root Container and the legacy autoloader. require_once getcwd ( ) . '/innomatic/core/classes/innomatic/core/RootContainer.php' ; $ rootContainer = \ Innomatic \ Core \ RootContainer :: instance ( '\Innomatic\Core\RootContainer' ) ; // Add the Symfony service container $ rootContainer -> setServiceContainer ( $ this -> container ) ; // Start the legacy Innomatic Container. $ innomatic = \ Innomatic \ Core \ InnomaticContainer :: instance ( '\Innomatic\Core\InnomaticContainer' ) ; // Set the Innomatic interface type to console. $ innomatic -> setInterface ( \ Innomatic \ Core \ InnomaticContainer :: INTERFACE_CONSOLE ) ; $ home = \ Innomatic \ Core \ RootContainer :: instance ( '\Innomatic\Core\RootContainer' ) -> getHome ( ) . 'innomatic/' ; // Start Innomatic. $ innomatic -> bootstrap ( $ home , $ home . 'core/conf/innomatic.ini' ) ; // Run the callback in the legacy core. $ result = $ innomatic -> runCallback ( $ callback ) ; } catch ( Exception $ e ) { // Go back to the new platform home. chdir ( $ platformHome ) ; // Clean the callback running state. $ this -> runningCallback = false ; throw $ e ; } // Go back to the new platform home. chdir ( $ platformHome ) ; // Clean the callback running state. $ this -> runningCallback = false ; return $ result ; }
Runs a callback function in the legacy core.

@param \Closure $callback
@throws \RuntimeException
@return mixed Callback result
Runs a callback function in the legacy core .