Browse Source

Update php version for Symfony (#5274)

Jérémy Derussé 5 years ago
parent
commit
02c394f5fb

+ 4 - 1
frameworks/PHP/symfony/composer.json

@@ -2,7 +2,7 @@
     "type": "project",
     "license": "proprietary",
     "require": {
-        "php": "^7.3.7",
+        "php": "^7.4",
         "ext-ctype": "*",
         "ext-iconv": "*",
         "ext-mbstring": "*",
@@ -17,6 +17,9 @@
     "require-dev": {
     },
     "config": {
+        "platform": {
+            "php": "7.4"
+        },
         "preferred-install": {
             "*": "dist"
         },

+ 12 - 9
frameworks/PHP/symfony/composer.lock

@@ -4,7 +4,7 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
         "This file is @generated automatically"
     ],
-    "content-hash": "ee5679fecd712cd637e59c7e75e1ef7f",
+    "content-hash": "86b16f3ed4090bf39c4593b797fd581b",
     "packages": [
         {
             "name": "doctrine/annotations",
@@ -404,22 +404,23 @@
         },
         {
             "name": "doctrine/doctrine-bundle",
-            "version": "2.0.0",
+            "version": "2.0.2",
             "source": {
                 "type": "git",
                 "url": "https://github.com/doctrine/DoctrineBundle.git",
-                "reference": "82826278bb88ae8c20aee3af3191430dcbcca63a"
+                "reference": "f96fac225563f5b3b4eeb2f80eb982b7f56484d8"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/doctrine/DoctrineBundle/zipball/82826278bb88ae8c20aee3af3191430dcbcca63a",
-                "reference": "82826278bb88ae8c20aee3af3191430dcbcca63a",
+                "url": "https://api.github.com/repos/doctrine/DoctrineBundle/zipball/f96fac225563f5b3b4eeb2f80eb982b7f56484d8",
+                "reference": "f96fac225563f5b3b4eeb2f80eb982b7f56484d8",
                 "shasum": ""
             },
             "require": {
                 "doctrine/dbal": "^2.9.0",
                 "jdorn/sql-formatter": "^1.2.16",
                 "php": "^7.1",
+                "symfony/cache": "^4.3.3|^5.0",
                 "symfony/config": "^4.3.3|^5.0",
                 "symfony/console": "^3.4.30|^4.3.3|^5.0",
                 "symfony/dependency-injection": "^4.3.3|^5.0",
@@ -434,7 +435,6 @@
                 "doctrine/coding-standard": "^6.0",
                 "doctrine/orm": "^2.6",
                 "phpunit/phpunit": "^7.5",
-                "symfony/cache": "^3.4.30|^4.3.3|^5.0",
                 "symfony/phpunit-bridge": "^4.2",
                 "symfony/property-info": "^4.3.3|^5.0",
                 "symfony/twig-bridge": "^3.4.30|^4.3.3|^5.0",
@@ -488,7 +488,7 @@
                 "orm",
                 "persistence"
             ],
-            "time": "2019-11-19T11:43:41+00:00"
+            "time": "2019-11-28T08:38:10+00:00"
         },
         {
             "name": "doctrine/event-manager",
@@ -3065,10 +3065,13 @@
     "prefer-stable": false,
     "prefer-lowest": false,
     "platform": {
-        "php": "^7.3.7",
+        "php": "^7.4",
         "ext-ctype": "*",
         "ext-iconv": "*",
         "ext-mbstring": "*"
     },
-    "platform-dev": []
+    "platform-dev": [],
+    "platform-overrides": {
+        "php": "7.4"
+    }
 }

+ 2 - 2
frameworks/PHP/symfony/src/Controller/DbController.php

@@ -67,11 +67,11 @@ class DbController
 
             // The new value have to be different from the previous. Otherwise Doctrine won't execute the update query
             // which is forbidden
-            $oldId = $world->getRandomNumber();
+            $oldId = $world->randomNumber;
             do {
                 $newId = mt_rand(1, 10000);
             } while($oldId === $newId);
-            $world->setRandomNumber($newId);
+            $world->randomNumber = $newId;
         }
         $this->entityManager->flush();
 

+ 2 - 5
frameworks/PHP/symfony/src/Controller/FortunesController.php

@@ -28,11 +28,8 @@ class FortunesController
     {
         $fortunes = $this->fortuneRepository->findBy([]);
 
-        $runtimeFortune = new Fortune();
-        $runtimeFortune->setId(0);
-        $runtimeFortune->setMessage('Additional fortune added at request time.');
-
-        $fortunes[] = $runtimeFortune;
+        $fortunes[] = $runtimeFortune = new Fortune();
+        $runtimeFortune->message = 'Additional fortune added at request time.';
 
         usort(
             $fortunes,

+ 3 - 23
frameworks/PHP/symfony/src/Entity/Fortune.php

@@ -14,30 +14,10 @@ class Fortune
      * @ORM\Id
      * @ORM\Column(type="integer")
      */
-    public $id;
+    public int $id = 0;
 
     /**
      * @ORM\Column(type="string")
      */
-    public $message;
-
-    public function setId(int $id): void
-    {
-        $this->id = $id;
-    }
-
-    public function getId(): int
-    {
-        return $this->id;
-    }
-
-    public function setMessage(string $message): void
-    {
-        $this->message = $message;
-    }
-
-    public function getMessage(): string
-    {
-        return $this->message;
-    }
-}
+    public string $message = '';
+}

+ 3 - 23
frameworks/PHP/symfony/src/Entity/World.php

@@ -14,30 +14,10 @@ class World
      * @ORM\Id
      * @ORM\Column(type="integer")
      */
-    public $id;
+    public int $id = 0;
 
     /**
      * @ORM\Column(type="integer")
      */
-    public $randomNumber;
-
-    public function setId(int $id): void
-    {
-        $this->id = $id;
-    }
-
-    public function getId(): int
-    {
-        return $this->id;
-    }
-
-    public function setRandomNumber(int $randomNumber): void
-    {
-        $this->randomNumber = $randomNumber;
-    }
-
-    public function getRandomNumber(): int
-    {
-        return $this->randomNumber;
-    }
-}
+    public int $randomNumber = 0;
+}

+ 5 - 5
frameworks/PHP/symfony/symfony-raw.dockerfile

@@ -5,13 +5,13 @@ ARG DEBIAN_FRONTEND=noninteractive
 RUN apt-get update -yqq && apt-get install -yqq software-properties-common > /dev/null
 RUN LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php
 RUN apt-get update -yqq > /dev/null && \
-    apt-get install -yqq nginx git unzip php7.3 php7.3-common php7.3-cli php7.3-fpm php7.3-mysql  > /dev/null
-RUN apt-get install -yqq php7.3-mbstring php7.3-xml  > /dev/null
+    apt-get install -yqq nginx git unzip php7.4 php7.4-common php7.4-cli php7.4-fpm php7.4-mysql  > /dev/null
+RUN apt-get install -yqq php7.4-mbstring php7.4-xml  > /dev/null
 
 RUN apt-get install -yqq composer > /dev/null
 
-COPY deploy/conf/* /etc/php/7.3/fpm/
-RUN if [ $(nproc) = 2 ]; then sed -i "s|pm.max_children = 1024|pm.max_children = 512|g" /etc/php/7.3/fpm/php-fpm.conf ; fi;
+COPY deploy/conf/* /etc/php/7.4/fpm/
+RUN if [ $(nproc) = 2 ]; then sed -i "s|pm.max_children = 1024|pm.max_children = 512|g" /etc/php/7.4/fpm/php-fpm.conf ; fi;
 
 ADD ./ /symfony
 WORKDIR /symfony
@@ -25,5 +25,5 @@ RUN sed -i '/PDO::ATTR_STATEMENT_CLASS/d' ./vendor/doctrine/dbal/lib/Doctrine/DB
 
 RUN php bin/console cache:clear
 
-CMD service php7.3-fpm start && \
+CMD service php7.4-fpm start && \
     nginx -c /symfony/deploy/nginx.conf -g "daemon off;"

+ 1 - 1
frameworks/PHP/symfony/symfony-swoole.dockerfile

@@ -1,4 +1,4 @@
-FROM php:7.3
+FROM php:7.4
 
 RUN pecl install swoole > /dev/null && \
     docker-php-ext-enable swoole

+ 5 - 5
frameworks/PHP/symfony/symfony.dockerfile

@@ -5,13 +5,13 @@ ARG DEBIAN_FRONTEND=noninteractive
 RUN apt-get update -yqq && apt-get install -yqq software-properties-common > /dev/null
 RUN LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php
 RUN apt-get update -yqq > /dev/null && \
-    apt-get install -yqq nginx git unzip php7.3 php7.3-common php7.3-cli php7.3-fpm php7.3-mysql  > /dev/null
-RUN apt-get install -yqq php7.3-mbstring php7.3-xml  > /dev/null
+    apt-get install -yqq nginx git unzip php7.4 php7.4-common php7.4-cli php7.4-fpm php7.4-mysql  > /dev/null
+RUN apt-get install -yqq php7.4-mbstring php7.4-xml  > /dev/null
 
 RUN apt-get install -yqq composer > /dev/null
 
-COPY deploy/conf/* /etc/php/7.3/fpm/
-RUN if [ $(nproc) = 2 ]; then sed -i "s|pm.max_children = 1024|pm.max_children = 512|g" /etc/php/7.3/fpm/php-fpm.conf ; fi;
+COPY deploy/conf/* /etc/php/7.4/fpm/
+RUN if [ $(nproc) = 2 ]; then sed -i "s|pm.max_children = 1024|pm.max_children = 512|g" /etc/php/7.4/fpm/php-fpm.conf ; fi;
 
 ADD ./ /symfony
 WORKDIR /symfony
@@ -25,5 +25,5 @@ RUN sed -i '/PDO::ATTR_STATEMENT_CLASS/d' ./vendor/doctrine/dbal/lib/Doctrine/DB
 
 RUN php bin/console cache:clear
 
-CMD service php7.3-fpm start && \
+CMD service php7.4-fpm start && \
     nginx -c /symfony/deploy/nginx.conf -g "daemon off;"

+ 1 - 1
toolset/databases/mysql/create.sql

@@ -31,7 +31,7 @@ declare v_counter int unsigned default 0;
     SET v_counter=v_counter+1;
   end while;
   commit;
-END 
+END
 #
 
 DELIMITER ;

+ 1 - 0
toolset/databases/mysql/my.cnf

@@ -15,6 +15,7 @@ socket          = /var/run/mysqld/mysqld.sock
 # * Basic Settings
 #
 default-storage-engine = innodb
+default_authentication_plugin = mysql_native_password
 
 user            = mysql
 pid-file        = /var/run/mysqld/mysqld.pid