UPGRADE-5.0.md
The underlying library used for sending emails (Swift Mailer) was discontinued and Mautic 5 is using the Symfony Mailer library instead. There are user facing changes coming with this change.
bin/console mautic:emails:send for sending emails via cron jobs was removed and now Symfony Messenger is used instead. Use this command to start a consumer: bin/console messenger:consume email. The Messenger in the async configuration can work with various queues.%kernel.root_dir% to %kernel.project_dir%/app as the "root_dir" was deprecated in Symfony 4 and removed in Symfony 5. The "project_dir" variable is path to the Mautic root directory. The "root_dir" variable was path to the app directory..env contains default values for the environment variables needed by the app.env.local uncommitted file with local overrides.env.$APP_ENV committed environment-specific defaults.env.$APP_ENV.local uncommitted environment-specific overridesAPP_ENV=dev and APP_DEBUG=1 in your .env.local file.Mautic\CoreBundle\Helper\UrlHelper::buildShortUrl() method. As a developer, use the \Mautic\CoreBundle\Shortener\Shortener::class service./app/config) was separated from local config (/config) to make Mautic more compatible with a Composer based workflows.db_driver and site_url parameters are set. It used to be db_driver and mailer_from_name./mailer/{transport}/callback to /mailer/callback.Mautic\EmailBundle\Mailer\Exception\UnsupportedTransportException was removed. Use EmailEvents::ON_TRANSPORT_WEBHOOK instead.Mautic\EmailBundle\Mailer\Transport\CallbackTransportInterface was removed. Use EmailEvents::ON_TRANSPORT_WEBHOOK instead.Mautic\EmailBundle\Event\TransportWebhookEvent does not have the transport in it. Each transport must validate the callback payload and decide if they are able to process it or not. If so, set the Response to the event to indicate success.Swift_Message was replaced with Mautic\EmailBundle\Mailer\Message\MauticMessage.Swift_Transport was replaced with Symfony\Component\Mailer\Transport\TransportInterface.Mautic\EmailBundle\Exception\PartialEmailSendFailureMautic\EmailBundle\Helper\PlainTextMessageHelperMautic\EmailBundle\Model\TransportTypeMautic\EmailBundle\DependencyInjection\Compiler\SpoolTransportPassMautic\EmailBundle\DependencyInjection\Compiler\EmailTransportPassMautic\EmailBundle\DependencyInjection\Compiler\SwiftmailerDynamicMailerPassmailer_) were replaced with the single configuration key mailer_dsn.app/bundles/EmailBundle/SwiftMailer were removed.bin/console mautic:segments:update will no longer update the campaign members but only the segment members. Use also command bin/console mautic:campaigns:update to update the campaign members if you haven't already. Both commands are recommended from Mautic 1.Mautic\LeadBundle\Command\CheckQueryBuildersCommand and the methods it use:
Mautic\LeadBundle\Model\ListModel::getVersionNew()Mautic\LeadBundle\Model\ListModel::getVersionOld()mautic:broadcast:send --limit=10 --batch=2 fix process emails with combination of parameters limit/batch. Before it processed all emails with batch 10. Now process 10 emails with batch 2. If you used to use before, probably you need change it.mautic.user.token.repository for Mautic\UserBundle\Entity\UserTokenRepository was removed as it was duplicated. Use mautic.user.repository.user_token instead.self::$container->get('mautic.http.client.mock_handler') with self::$container->get(\GuzzleHttp\Handler\MockHandler::class) to get HTTP client mock handler.composer install then it will also run npm install to download JS dependencies and bin/console mautic:assets:generate to build the production assets.jquery-color, jquery-play-sound and html5notifications were removed as unused. Details in https://github.com/mautic/mautic/pull/12265.jvectormap was replaced with its accessor jvectormap-next as it was unmaintaned. Details in https://github.com/mautic/mautic/pull/12359.quicksearch was updated from unmaintained vendor to latest version of its successor. Details in https://github.com/mautic/mautic/pull/12372.jQueryUI was updated from version 1.12.1 to 1.13.2. Details in https://github.com/mautic/mautic/pull/12394.Mautic\UserBundle\Security\Firewall\AuthenticationListener::class no longer implements the deprecated Symfony\Component\Security\Http\Firewall\ListenerInterface and was made final. The public function handle(GetResponseEvent $event) method was changed to public function __invoke(RequestEvent $event): void to support Symfony 5.Mautic\IntegrationsBundle\Configuration\PluginConfiguration removed - we don't use itMautic\SmsBundle\Callback\ResponseInterface removed - we don't use itMautic\CoreBundle\Controller\AbstractModalFormController removed - we don't use itMautic\CoreBundle\Templating\Helper\ExceptionHelper removed - we don't use itMautic\LeadBundle\Model\LeadModel::getContactFromRequest() method removed. Use Mautic\LeadBundle\Helper\ContactRequestHelper::getContactFromQuery() instead.Mautic\LeadBundle\Model\LeadModel::mergeLeads() method removed. Use \Mautic\LeadBundle\Deduplicate\ContactMerger::merge() directly.Mautic\LeadBundle\Model\LeadModel::checkForDuplicateContact() method do not take Lead as a second parameter anymore and so it do not merges contacts. Use \Mautic\LeadBundle\Deduplicate\ContactMerger::merge() afterwards.Mautic\LeadBundle\Model\LegacyLeadModel removed. Use \Mautic\LeadBundle\Deduplicate\ContactMerger instead.Mautic\ReportBundle\Event\ReportGeneratorEvent::applyTagFilter() removed. Use Mautic\ReportBundle\Builder\MauticReportBuilder::getTagCondition() instead.Mautic\CoreBundle\Form\DataTransformer\EmojiToShortTransformer was removed. DetailsMautic\CoreBundle\Doctrine\AbstractMauticMigration::entityManager protected property was removed as unused.Symfony\Component\Security\Core\User\AdvancedUserInterface as it was removed from Symfony 5. These methods required by the interface were also removed:
Mautic\UserBundle\Entity\User::isAccountNonExpired()Mautic\UserBundle\Entity\User::isAccountNonLocked()Mautic\UserBundle\Entity\User::isCredentialsNonExpired()Mautic\UserBundle\Entity\User::isEnabled()AbstractMauticTestCase::loadFixtures and AbstractMauticTestCase::loadFixtureFiles now accept only two arguments: array $fixtures and bool $append. If you need to use old parameters - refer to the documentation of LiipTestFixturesBundleMautic\CoreBundle\Controller\CommonController::addFlash() was renamed to CommonController::addFlashMessage()to prevent naming collision with Symfony\Bundle\FrameworkBundle\Controller\AbstractController::addFlash(). Controllers adding flash messages should use $this->addFlashMessage().mtc_sid removed.php-http/mock-client was removed as abandoned and unused. See https://github.com/mautic/mautic/pull/12439'mautic.guzzle.client' service was removed. Use 'mautic.http.client' instead.mrclay/minify with matthiasmullie/minify for faster asset generation.QueueService removed without replacementapp/bundles/QueueBundle/Helper/QueueRequestHelper.php in favor of serialization (reused)mautic:queue:process is no longer available, use messenger:consume insteadMautic 5 adds support for Symfony's autowiring and autoconfigure for services.
Advantages:
app/config/services.php is automatically configuring all bundles including plugins so if the bundle doesn't do anything uncommon then it should work out of the box.*Bundle/Config/config.php file are still working but will be removed in Mautic 6.Possible backward compatibility breaks:
plugins/*Bundle/Config/services.php to exclude the folders or files from autowiring.