]> Raphaƫl G. Git Repositories - airbundle/blobdiff - Controller/AbstractController.php
Fix translation string
[airbundle] / Controller / AbstractController.php
index d13c675fac56f26bc802614eaf4b205853e82550..423d2fdb7806403f221312cf177ff1d8ef93f623 100644 (file)
@@ -44,7 +44,6 @@ use Rapsys\AirBundle\RapsysAirBundle;
 
 use Rapsys\PackBundle\Util\FacebookUtil;
 use Rapsys\PackBundle\Util\ImageUtil;
-use Rapsys\PackBundle\Util\MapUtil;
 use Rapsys\PackBundle\Util\SluggerUtil;
 
 /**
@@ -71,7 +70,7 @@ abstract class AbstractController extends BaseAbstractController implements Serv
        /**
         * Modified DateTime
         */
-       protected \DateTime $modified;
+       protected \DateTimeImmutable $modified;
 
        /**
         * DatePeriod instance
@@ -105,7 +104,6 @@ abstract class AbstractController extends BaseAbstractController implements Serv
         * @param ImageUtil $image The image instance
         * @param MailerInterface $mailer The mailer instance
         * @param EntityManagerInterface $manager The manager instance
-        * @param MapUtil $map The map instance
         * @param PackageInterface $package The package instance
         * @param RouterInterface $router The router instance
         * @param Security $security The security instance
@@ -117,7 +115,7 @@ abstract class AbstractController extends BaseAbstractController implements Serv
         * @TODO move all that stuff to setSlugger('@slugger') setters with a calls: [ setSlugger: [ '@slugger' ] ] to unbload classes ???
         * @TODO add a calls: [ ..., prepare: ['@???'] ] that do all the logic that can't be done in constructor because various things are not available
         */
-       public function __construct(protected AuthorizationCheckerInterface $checker, protected ContainerInterface $container, protected AccessDecisionManagerInterface $decision, protected ManagerRegistry $doctrine, protected FacebookUtil $facebook, protected FormFactoryInterface $factory, protected ImageUtil $image, protected MailerInterface $mailer, protected EntityManagerInterface $manager, protected MapUtil $map, protected PackageInterface $package, protected RouterInterface $router, protected Security $security, protected SluggerUtil $slugger, protected RequestStack $stack, protected TranslatorInterface $translator, protected Environment $twig, protected int $limit = 5) {
+       public function __construct(protected AuthorizationCheckerInterface $checker, protected ContainerInterface $container, protected AccessDecisionManagerInterface $decision, protected ManagerRegistry $doctrine, protected FacebookUtil $facebook, protected FormFactoryInterface $factory, protected ImageUtil $image, protected MailerInterface $mailer, protected EntityManagerInterface $manager, protected PackageInterface $package, protected RouterInterface $router, protected Security $security, protected SluggerUtil $slugger, protected RequestStack $stack, protected TranslatorInterface $translator, protected Environment $twig, protected int $limit = 5) {
                //Retrieve config
                $this->config = $container->getParameter(RapsysAirBundle::getAlias());
 
@@ -218,7 +216,7 @@ abstract class AbstractController extends BaseAbstractController implements Serv
         *
         * {@inheritdoc}
         */
-       protected function render(string $view, array $parameters = [], Response $response = null): Response {
+       protected function render(string $view, array $parameters = [], ?Response $response = null): Response {
                //Create response when null
                $response ??= new Response();
 
@@ -295,7 +293,7 @@ abstract class AbstractController extends BaseAbstractController implements Serv
                                //Create ApplicationType form
                                $application = $this->factory->create('Rapsys\AirBundle\Form\ApplicationType', null, [
                                        //Set the action
-                                       'action' => $this->generateUrl('rapsys_air_application_add'),
+                                       'action' => $this->generateUrl('rapsysair_application_add'),
                                        //Set the form attribute
                                        'attr' => [ 'class' => 'col' ],
                                        //Set dance choices
@@ -452,7 +450,7 @@ abstract class AbstractController extends BaseAbstractController implements Serv
                //With empty locations link
                if (empty($parameters['locations_link'])) {
                        //Set locations link
-                       $parameters['locations_link'] = $this->router->generate('rapsys_air_location');
+                       $parameters['locations_link'] = $this->router->generate('rapsysair_location');
                }
 
                //With empty locations title
@@ -501,7 +499,7 @@ abstract class AbstractController extends BaseAbstractController implements Serv
                //Without facebook image defined and texts
                if (empty($parameters['facebook']['og:image']) && !empty($this->request) && !empty($parameters['fbimage']['texts']) && !empty($this->modified)) {
                        //Get facebook image
-                       $parameters['facebook'] += $this->facebook->getImage($this->request->getPathInfo(), $parameters['fbimage']['texts'], $this->modified->getTimestamp());
+                       $parameters['facebook'] += $this->image->getFacebook($this->request->getPathInfo(), $parameters['fbimage']['texts'], $this->modified->getTimestamp());
                }
 
                //Call twig render method
@@ -538,7 +536,6 @@ abstract class AbstractController extends BaseAbstractController implements Serv
                        'mailer.mailer' => MailerInterface::class,
                        'rapsysair.facebook_util' => FacebookUtil::class,
                        'rapsyspack.image_util' => ImageUtil::class,
-                       'rapsyspack.map_util' => MapUtil::class,
                        'rapsyspack.path_package' => PackageInterface::class,
                        'rapsyspack.slugger_util' => SluggerUtil::class,
                        'rapsysuser.access_decision_manager' => AccessDecisionManagerInterface::class,