Skip to content

WIP: [POC] Migrate to Symfony 4

Thomas requested to merge sf4 into develop

What changes :

  • Now requires PHP 7.1
  • Now fully MVC (Controller classes replace plain old php files)
  • Uses Symfony Router
    • No need for .htaccess anymore, run directly on nginx, php server & cie
    • Routes for polls have been changed from /{pollId} to /p/{pollId} and /{pollAdminId}/admin to /a/{pollAdminId} in order for wildcards to not conflict with other routes. Therefore either :
      • We keep the old routes with some regex hacks for compatibility (this will also benefit easier migration for other instances)
      • We let the old forms expire and redirect to for new ones
  • Uses Symfony Forms (not everywhere for now)
  • Correct entities for Polls, Choices, Slots, ... (WIP)
  • Twig templates replace Smarty ones
  • Adds a few functional tests : this allows better functional ones
  • Changes custom migration classes with Doctrine ones
  • Replaces PHPMailer with Swift_Mailer
  • Assets are handled with Webpack (Symfony Webpack Encore)
  • Translations are now handled with Symfony Translation Component (probably need more structure)
  • Configuration is now handled though environment (or .env files)

What doesn't change :

  • Most services
  • Most repositories (though \PDO has been replaced with more abstract Doctrine DBAL)
  • User Interface

What still needs to be done :

  • Full process functional tests
  • Complete migration from Smarty to Twig
  • Map every data to correct objects and use correct forms on them
  • Clean code
  • Migrate code to PHP7.1 (mostly types)
  • Improve js code
  • Backport Framadate v1.x changes
  • Inject configuration properly
  • Protect /admin (with User system ?)
  • Add back find polls options
  • ...

How to test :

  • checkout this branch
  • copy .env.dist to .env and put in correct values for database
  • composer install to install php libraries
  • npm install to install assets libraries
  • ./node_modules/.bin/encore production to build assets
  • bin/console doctrine:migrations:migrate to migrate database (or not, see below)
  • php -S localhost:8080 -t public and access localhost:8080 inside your browser or you can also see for webservers
  • Browse to /admin/migration if you didn't migrate database before
Edited by Thomas

Merge request reports