sf4 resolve errors and depreciations

This commit is contained in:
Tchama 2020-07-30 13:53:15 +02:00
parent 7881efa5fe
commit ced9d17d03
92 changed files with 52 additions and 51 deletions

View File

@ -134,17 +134,6 @@ class ChillMainExtension extends Extension implements PrependExtensionInterface,
public function prepend(ContainerBuilder $container)
{
$bundles = $container->getParameter('kernel.bundles');
//add ChillMain to assetic-enabled bundles
if (!isset($bundles['AsseticBundle'])) {
throw new MissingBundleException('AsseticBundle');
}
$asseticConfig = $container->getExtensionConfig('assetic');
$asseticConfig['bundles'][] = 'ChillMainBundle';
$container->prependExtensionConfig('assetic',
array('bundles' => array('ChillMainBundle')));
//add installation_name and date_format to globals
$chillMainConfig = $container->getExtensionConfig($this->getAlias());
$config = $this->processConfiguration($this

View File

@ -37,8 +37,8 @@ class Configuration implements ConfigurationInterface
*/
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('chill_main');
$treeBuilder = new TreeBuilder('chill_main');
$rootNode = $treeBuilder->getRootNode('chill_main');
$rootNode
->children()

View File

@ -149,8 +149,8 @@ trait AddWidgetConfigurationTrait
*/
protected function addWidgetsConfiguration($place, ContainerBuilder $containerBuilder)
{
$treeBuilder = new TreeBuilder();
$root = $treeBuilder->root($place)
$treeBuilder = new TreeBuilder($place);
$root = $treeBuilder->getRootNode($place)
->canBeUnset()
->info('register widgets on place "'.$place.'"');

View File

@ -19,6 +19,7 @@ namespace Chill\MainBundle\Notification;
use Chill\MainBundle\Entity\User;
use Psr\Log\LoggerInterface;
use Symfony\Component\Mailer\MailerInterface;
use Symfony\Component\Routing\RouterInterface;
use Symfony\Component\Translation\TranslatorInterface;
@ -75,10 +76,10 @@ class Mailer
public function __construct(
LoggerInterface $logger,
\Twig\Environment $twig,
\Swift_Mailer $mailer,
MailerInterface $mailer,
// due to bug https://github.com/symfony/swiftmailer-bundle/issues/127
\Swift_Transport $mailerTransporter,
RouterInterface $router,
// \Swift_Transport $mailerTransporter,
RouterInterface $router,
TranslatorInterface $translator,
$routeParameters
) {
@ -88,7 +89,7 @@ class Mailer
$this->router = $router;
$this->translator = $translator;
$this->routeParameters = $routeParameters;
$this->forcedMailer = new \Swift_Mailer($mailerTransporter);
//$this->forcedMailer = new \Swift_Mailer($mailerTransporter);
}

View File

@ -22,13 +22,16 @@
namespace Chill\MainBundle\Pagination;
use Twig\Extension\AbstractExtension;
use Twig\TwigFunction;
/**
* add twig function to render pagination
*
* @author Julien Fastré <julien.fastre@champs-libres.coop>
* @author Champs Libres <info@champs-libres.coop>
*/
class ChillPaginationTwig extends \Twig_Extension
class ChillPaginationTwig extends AbstractExtension
{
const LONG_TEMPLATE = 'ChillMainBundle:Pagination:long.html.twig';
const SHORT_TEMPLATE = 'ChillMainBundle:Pagination:short.html.twig';
@ -41,7 +44,7 @@ class ChillPaginationTwig extends \Twig_Extension
public function getFunctions()
{
return array(
new \Twig_SimpleFunction(
new TwigFunction(
'chill_pagination',
array($this, 'paginationRender'),
array(

View File

@ -4,7 +4,7 @@ services:
- "@logger"
- "@twig"
- "@mailer"
- "@swiftmailer.transport"
# - "@swiftmailer.transport"
- "@router"
- "@translator"
- "%chill_main.notifications%"

View File

@ -6,5 +6,5 @@ services:
- { name: kernel.event_subcriber }
Chill\MainBundle\Redis\ChillRedis:
factory: 'Chill\MainBundle\Redis\RedisConnectionFactory:create'
factory: [ '@Chill\MainBundle\Redis\RedisConnectionFactory', 'create' ]

View File

@ -1,20 +1,20 @@
services:
twig_intl:
class: Twig_Extensions_Extension_Intl
tags:
- { name: twig.extension }
twig_date:
class: Twig_Extensions_Extension_Date
arguments:
- "@translator"
tags:
- { name: twig.extension }
twig_text:
class: Twig_Extensions_Extension_Text
tags:
- { name: twig.extension }
# twig_intl:
# class: Twig_Extensions_Extension_Intl
# tags:
# - { name: twig.extension }
#
# twig_date:
# class: Twig_Extensions_Extension_Date
# arguments:
# - "@translator"
# tags:
# - { name: twig.extension }
#
# twig_text:
# class: Twig_Extensions_Extension_Text
# tags:
# - { name: twig.extension }
Chill\MainBundle\Templating\ChillTwigHelper:
tags:

View File

@ -80,7 +80,6 @@ Create: Créer
show: voir
Show: Voir
edit: modifier
Edit: Modifier
Main admin menu: Menu d'administration principal
Actions: Actions
Users and permissions: Utilisateurs et permissions
@ -111,7 +110,6 @@ Permission group: Groupe de permissions
Permissionsgroup: Group de permissions
New permission group: Nouveau groupe de permissions
PermissionsGroup "%name%" edit: Modification du groupe de permission '%name%'
Grant new permissions: Attribuer de nouvelles permissions
Role: Rôle
Choose amongst roles: Choisir parmi les rôles
Add permission: Ajouter les permissions

View File

@ -24,13 +24,15 @@ namespace Chill\MainBundle\Routing;
use Chill\MainBundle\Routing\MenuComposer;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Twig\Extension\AbstractExtension;
use Twig\TwigFunction;
/**
* Add the filter 'chill_menu'
*
* @author Julien Fastré <julien arobase fastre point info>
*/
class MenuTwig extends \Twig_Extension implements ContainerAwareInterface
class MenuTwig extends AbstractExtension implements ContainerAwareInterface
{
/**
@ -63,7 +65,7 @@ class MenuTwig extends \Twig_Extension implements ContainerAwareInterface
public function getFunctions()
{
return [new \Twig_SimpleFunction('chill_menu',
return [new TwigFunction('chill_menu',
array($this, 'chillMenu'), array(
'is_safe' => array('html'),
'needs_environment' => true

View File

@ -22,13 +22,16 @@
namespace Chill\MainBundle\Templating;
use Twig\Extension\AbstractExtension;
use Twig\TwigFilter;
/**
* Twig filter to transform a string in a safer way to be the content of a csv
* cell.
*
* This filter replace the char " by ""
*/
class CSVCellTwig extends \Twig_Extension
class CSVCellTwig extends AbstractExtension
{
/*
* Returns a list of filters to add to the existing list.
@ -39,7 +42,7 @@ class CSVCellTwig extends \Twig_Extension
public function getFilters()
{
return array(
new \Twig_SimpleFilter(
new TwigFilter(
'csv_cell',
array($this, 'csvCellFilter'),
array('is_safe' => array('html')))

View File

@ -21,6 +21,7 @@
namespace Chill\MainBundle\Templating;
use Twig\Extension\AbstractExtension;
use Twig\Node\Node;
use Twig\TwigFunction;
use Twig\TwigFilter;
use Symfony\Component\HttpFoundation\RequestStack;
@ -72,7 +73,7 @@ class ChillTwigRoutingHelper extends AbstractExtension
];
}
public function isUrlGenerationSafe(\Twig_Node $argsNode)
public function isUrlGenerationSafe(Node $argsNode)
{
return $this->originalExtension->isUrlGenerationSafe($argsNode);
}

View File

@ -22,8 +22,10 @@
namespace Chill\MainBundle\Templating;
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
use Twig\Extension\AbstractExtension;
use Twig\TwigFilter;
class TranslatableStringTwig extends \Twig_Extension
class TranslatableStringTwig extends AbstractExtension
{
use ContainerAwareTrait;
@ -51,7 +53,7 @@ class TranslatableStringTwig extends \Twig_Extension
public function getFilters()
{
return array(
new \Twig_SimpleFilter(
new TwigFilter(
'localize_translatable_string', array($this, 'localize')));
}

View File

@ -22,6 +22,8 @@ namespace Chill\MainBundle\Templating\Widget;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Chill\MainBundle\Templating\Widget\WidgetInterface;
use Chill\MainBundle\Templating\Events\DelegatedBlockRenderingEvent;
use Twig\Extension\AbstractExtension;
use Twig\TwigFunction;
/**
* Add the function `chill_delegated_block`.
@ -49,7 +51,7 @@ use Chill\MainBundle\Templating\Events\DelegatedBlockRenderingEvent;
*
* @author Julien Fastré <julien.fastre@champs-libres.coop>
*/
class WidgetRenderingTwig extends \Twig_Extension
class WidgetRenderingTwig extends AbstractExtension
{
/**
@ -90,14 +92,14 @@ class WidgetRenderingTwig extends \Twig_Extension
public function getFunctions()
{
return array(
new \Twig_SimpleFunction('chill_delegated_block',
new TwigFunction('chill_delegated_block',
array($this, 'renderingWidget'),
array(
'is_safe' => array('html'),
'needs_environment' => true,
'deprecated' => true, 'alternative' => 'chill_widget'
)),
new \Twig_SimpleFunction('chill_widget',
new TwigFunction('chill_widget',
array($this, 'renderingWidget'),
array('is_safe' => array('html'), 'needs_environment' => true))
);