Global navigation

   Documentation Center
   eZ Studio & eZ Platform
     User Manual
     Technical Manual
     Glossary
   eZ Publish 4.x / legacy

 
eZ Publish (5.x)

eZ Publish 5.x | For eZ Platform & eZ Studio topics see Technical manual and User manual, for eZ Publish 4.x and Legacy topics see eZ Publish legacy

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: clarification ref. EZP-26557

...

eZ Publish 5 still relies on the legacy kernel (from 4.x) and runs it when needed inside an isolated PHP closure, making it sandboxed. This  This is available for your use as well making it possible to run some PHP code inside that sandbox through the runCallback() methodthrough the runCallback() method.

Warning

All calls from Platform/Symfony stack to legacy stack should be run inside a runCallback() call.

Code Block
languagephp
titleSimple legacy code example
<?php
// Declare use statements for the classes you may need
use eZINI;

// Inside a controller extending eZ\Bundle\EzPublishCoreBundle\Controller
$settingName = 'MySetting';
$test = array( 'oneValue', 'anotherValue' );
$myLegacySetting = $this->getLegacyKernel()->runCallback(
    function () use ( $settingName, $test )
    {
        // Here you can reuse $settingName and $test variables inside the legacy context
        $ini = eZINI::instance( 'someconfig.ini' );
        return $ini->variable( 'SomeSection', $settingName );
    }
);

...