mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-21 08:12:26 +02:00
N°1280 Upgrade Silex library to 2.2 (Which is possible as iTop 2.5 requirements are now PHP 5.6+!)
SVN:trunk[5305]
This commit is contained in:
@@ -377,9 +377,9 @@ class ObjectFormManager extends FormManager
|
||||
if ($this->aFormProperties['layout']['type'] === 'twig')
|
||||
{
|
||||
// Creating sandbox twig env. to load and test the custom form template
|
||||
$oTwig = new \Twig_Environment(new \Twig_Loader_String());
|
||||
$oTwig = new \Twig_Environment(new \Twig_Loader_Array( array($oForm->GetId() => $this->aFormProperties['layout']['content']) ));
|
||||
ApplicationHelper::RegisterTwigExtensions($oTwig);
|
||||
$sRendered = $oTwig->render($this->aFormProperties['layout']['content'], array('oRenderer' => $this->oRenderer, 'oObject' => $this->oObject));
|
||||
$sRendered = $oTwig->render($oForm->GetId(), array('oRenderer' => $this->oRenderer, 'oObject' => $this->oObject));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -23,6 +23,8 @@ use Exception;
|
||||
use Silex\Application;
|
||||
use Symfony\Component\Debug\ErrorHandler;
|
||||
use Symfony\Component\Debug\ExceptionHandler;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpKernel\Exception\HttpException;
|
||||
use Twig_Environment;
|
||||
use Twig_SimpleFilter;
|
||||
use Dict;
|
||||
@@ -277,16 +279,18 @@ class ApplicationHelper
|
||||
// Intercepting manually aborted request
|
||||
if (1 || !$oApp['debug'])
|
||||
{
|
||||
$oApp->error(function(Exception $e, $code) use ($oApp)
|
||||
$oApp->error(function(Exception $oException, Request $oRequest) use ($oApp)
|
||||
{
|
||||
$iErrorCode = ($oException instanceof HttpException) ? $oException->getStatusCode() : 500;
|
||||
|
||||
$aData = array(
|
||||
'exception' => $e,
|
||||
'code' => $code,
|
||||
'exception' => $oException,
|
||||
'code' => $iErrorCode,
|
||||
'error_title' => '',
|
||||
'error_message' => $e->getMessage()
|
||||
'error_message' => $oException->getMessage()
|
||||
);
|
||||
|
||||
switch ($code)
|
||||
switch ($iErrorCode)
|
||||
{
|
||||
case 404:
|
||||
$aData['error_title'] = Dict::S('Error:HTTP:404');
|
||||
@@ -298,15 +302,15 @@ class ApplicationHelper
|
||||
|
||||
IssueLog::Error($aData['error_title'] . ' : ' . $aData['error_message']);
|
||||
|
||||
if ($oApp['request']->isXmlHttpRequest())
|
||||
if ($oApp['request_stack']->getCurrentRequest()->isXmlHttpRequest())
|
||||
{
|
||||
$oResponse = $oApp->json($aData, $code);
|
||||
$oResponse = $oApp->json($aData, $iErrorCode);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Preparing debug trace
|
||||
$aSteps = array();
|
||||
foreach($e->getTrace() as $aStep)
|
||||
foreach($oException->getTrace() as $aStep)
|
||||
{
|
||||
// - Default file name
|
||||
if(!isset($aStep['file']))
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
namespace Combodo\iTop\Portal\Provider;
|
||||
|
||||
use Silex\Application;
|
||||
use Silex\ServiceProviderInterface;
|
||||
use Pimple\Container;
|
||||
use Pimple\ServiceProviderInterface;
|
||||
use Combodo\iTop\Portal\Helper\ContextManipulatorHelper;
|
||||
|
||||
/**
|
||||
@@ -31,9 +31,9 @@ use Combodo\iTop\Portal\Helper\ContextManipulatorHelper;
|
||||
class ContextManipulatorServiceProvider implements ServiceProviderInterface
|
||||
{
|
||||
|
||||
public function register(Application $oApp)
|
||||
public function register(Container $oApp)
|
||||
{
|
||||
$oApp['context_manipulator'] = $oApp->share(function ($oApp)
|
||||
$oApp['context_manipulator'] = function ($oApp)
|
||||
{
|
||||
$oApp->flush();
|
||||
|
||||
@@ -41,10 +41,10 @@ class ContextManipulatorServiceProvider implements ServiceProviderInterface
|
||||
$oContextManipulatorHelper->SetApp($oApp);
|
||||
|
||||
return $oContextManipulatorHelper;
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
public function boot(Application $oApp)
|
||||
public function boot(Container $oApp)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
namespace Combodo\iTop\Portal\Provider;
|
||||
|
||||
use Silex\Application;
|
||||
use Silex\ServiceProviderInterface;
|
||||
use Pimple\Container;
|
||||
use Pimple\ServiceProviderInterface;
|
||||
use Combodo\iTop\Portal\Helper\LifecycleValidatorHelper;
|
||||
|
||||
/**
|
||||
@@ -31,9 +31,9 @@ use Combodo\iTop\Portal\Helper\LifecycleValidatorHelper;
|
||||
class LifecycleValidatorServiceProvider implements ServiceProviderInterface
|
||||
{
|
||||
|
||||
public function register(Application $oApp)
|
||||
public function register(Container $oApp)
|
||||
{
|
||||
$oApp['lifecycle_validator'] = $oApp->share(function ($oApp)
|
||||
$oApp['lifecycle_validator'] = function ($oApp)
|
||||
{
|
||||
$oApp->flush();
|
||||
|
||||
@@ -44,10 +44,10 @@ class LifecycleValidatorServiceProvider implements ServiceProviderInterface
|
||||
}
|
||||
|
||||
return $oLifecycleValidatorHelper;
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
public function boot(Application $oApp)
|
||||
public function boot(Container $oApp)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
namespace Combodo\iTop\Portal\Provider;
|
||||
|
||||
use Silex\Application;
|
||||
use Silex\ServiceProviderInterface;
|
||||
use Pimple\Container;
|
||||
use Pimple\ServiceProviderInterface;
|
||||
use Combodo\iTop\Portal\Helper\ScopeValidatorHelper;
|
||||
|
||||
/**
|
||||
@@ -31,9 +31,9 @@ use Combodo\iTop\Portal\Helper\ScopeValidatorHelper;
|
||||
class ScopeValidatorServiceProvider implements ServiceProviderInterface
|
||||
{
|
||||
|
||||
public function register(Application $oApp)
|
||||
public function register(Container $oApp)
|
||||
{
|
||||
$oApp['scope_validator'] = $oApp->share(function ($oApp)
|
||||
$oApp['scope_validator'] = function ($oApp)
|
||||
{
|
||||
$oApp->flush();
|
||||
|
||||
@@ -44,10 +44,10 @@ class ScopeValidatorServiceProvider implements ServiceProviderInterface
|
||||
}
|
||||
|
||||
return $oScopeValidatorHelper;
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
public function boot(Application $oApp)
|
||||
public function boot(Container $oApp)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
namespace Combodo\iTop\Portal\Provider;
|
||||
|
||||
use Silex\Application;
|
||||
use Silex\ServiceProviderInterface;
|
||||
use Pimple\Container;
|
||||
use Pimple\ServiceProviderInterface;
|
||||
use Combodo\iTop\Portal\Helper\UrlGenerator;
|
||||
|
||||
/**
|
||||
@@ -31,17 +31,17 @@ use Combodo\iTop\Portal\Helper\UrlGenerator;
|
||||
class UrlGeneratorServiceProvider implements ServiceProviderInterface
|
||||
{
|
||||
|
||||
public function register(Application $oApp)
|
||||
public function register(Container $oApp)
|
||||
{
|
||||
$oApp['url_generator'] = $oApp->share(function ($oApp)
|
||||
$oApp['url_generator'] = function ($oApp)
|
||||
{
|
||||
$oApp->flush();
|
||||
|
||||
return new UrlGenerator($oApp['routes'], $oApp['request_context']);
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
public function boot(Application $oApp)
|
||||
public function boot(Container $oApp)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user