0.10

Project migration

  • remove config/bootstrap.php
  • setup new public/index.php (see https://gitlab.3wmedia.nl/project/sandbox/-/blob/development/public/index.php)
  • setup new bin/console (see https://gitlab.3wmedia.nl/project/sandbox/-/blob/development/bin/console)
  • compare project composer.json
    • remove deployer/deployer
    • remove symfony/dotenv
    • remove doctrine/data-fixtures
    • remove doctrine/doctrine-fixtures-bundle
    • remove doctrine/doctrine-migrations-bundle
    • add phpunit/phpunit
    • compare other dependency versions
    • remove cache:warmup script
    • check assets:install script
    • configure php platform
    • copy "replace" entries
    • configure extra symfony require to 5.1.*
    • install new dependencies with rm -rf vendor && composer update
    • remove flex recipe files like config/packages/dev/debug.yaml and config/packages/mailer.yaml and tests/bootstrap.php
  • merge all config/packages/w3media* into single w3media.yml config file
    • remove in_memory users from security.yml, and move users to w3media_core.security.users (username key should be username: <username> and roles needs to be an array)
  • merge security.yml
    • merge role_hierarchy
    • enable switch_user on admin firewall
    • require ROLE_ADMIN instead of ROLE_CUSTOMER on ^/admin in access_control
  • remove config/routes/dev/twig.yml
  • add config/routes/dev/framework.yml (see https://gitlab.3wmedia.nl/project/sandbox/-/blob/development/config/routes/dev/framework.yaml)
  • compare .env/.env.dist
    • add missing entries
    • configure symfony mailer DSN instead of old sendmail/swiftmailer config
    • remove MEDIA_ASSET_URL (unless all domains need to load images from the same domain)
    • MAILER_SENDMAIL always true in production on Cobytes servers (true configures the sendmail correctly, and completely ignores MAILER_DSN env var)
  • compare config/services.yml (remove public: false line)
  • compare config/bundles.php
    • add DebugBundle
    • replace WhiteOctoberPagerfantaBundle with BabDevPagerfantaBundle
    • remove SwiftmailerBundle
    • remove DoctrineCacheBundle
    • remove swiftmailer+webserver bundle
  • compare .gitignore
  • remove contents of phpstan.neon (no longer need to include level1 config file)
  • compare Makefile
    • stan: increased memory + level 2 checking
    • test: SF_VERSION changed to 5.1
  • compare .gitlab-ci.yml
    • cache add: bin/.phpunit/
    • test:analyze tag '2g'
  • compare phpunit.xml.dist

App code migration

  • if parameter kernel.root_dir is used, replace it with kernel.project_dir (WARNING: this parameter directory location is one level above the old root_dir which pointed into the src/ directory)
  • src/Block/* - method "isEditable" compatibility, needs nullable ?PageBlock argument (see https://gitlab.3wmedia.nl/lib/framework/-/blob/development/src/Component/Block/Block/BlockInterface.php#L67)
  • replace \Swift_Mailer with Mailer (if mail composed on app level, refactor \Swift_Message into Email class. See framework for examples)
  • replace Symfony\Bridge\Doctrine\RegistryInterface with Symfony\Bridge\Doctrine\ManagerRegistry in type hints and doctypes
  • replace Symfony\Component\Translation\TranslatorInterface with Symfony\Contracts\Translation\TranslatorInterface in type hints and doctypes (change class property type to TranslatorInterface|LocaleAwareInterface if getLocale() method typehint is needed)
  • replace translator ->transChoice() (both in controllers and views) method call with ->trans(), using a '%count%' parameter (4 arguments to 3 arguments. Count argument is used as %count% in trans parameters)
  • if app extends FormMailer, this service now needs more arguments in parent::__construct(), e.g. FormConfig and ManagerRegistry
  • if there are console commands on app level, the execute function MUST return an int or it will throw an error. Use Command::SUCCESS or Command::FAILURE
  • if monolog used on app level, replace ->add*() method calls without the "add". (addWarning -> warning, addInfo -> info, ...)
  • if used replace \Twig_Environment with Twig\Environment
  • test on project level with make test and make stan
  • a new migration is currently needed on 0.10 for custom_date and use_custom_dates on the table accommodation_arrangement table
  • the Doctrine migration which creates the table auth_user fails on mariadb 5.5, manually append the create table query with the following at the end: ROW_FORMAT=DYNAMIC
  • Check for 'spaceless' twig tags in project code. These need to be turned into apply spaceless / endapply instead.

Deploy

  • before deploying, run this query to update old migrations to the new format ### UPDATE migration_versions SET version=CONCAT('DoctrineMigrations\Version', version) ###
  • create a cronjob running every minute, example: /usr/local/bin/php /home/sandbox/application/accept/current/bin/console w3media:schedule:execute >/dev/null 2>&1