If you are experiencing issues with translations, make sure that
you have the following in config/packages/php_translation.yaml
:
# php-translation config
translation:
configs:
bolt:
output_dir: "%kernel.project_dir%/translations"
Note this only applies to Bolt 5 beta versions.
If you're updating a previous Bolt 4 Beta to the latest, you might bump into some quirks. Read below on how to fix these
The base command to update is always:
composer update
bin/console cache:clear
If you get this error, edit config/packages/doctrine.yaml
and make sure the following is included:
dql:
string_functions:
JSON_EXTRACT: Bolt\Doctrine\Functions\JsonExtract
CAST: DoctrineExtensions\Query\Mysql\Cast
INSTR: DoctrineExtensions\Query\Mysql\Instr
numeric_functions:
RAND: Bolt\Doctrine\Functions\Rand
If you get the following error:
The file "../vendor/bolt/core/src/Controller/Backend/" does not exist (in: "…/config/routes")
in ../vendor/bolt/core/src/Controller/Backend/
Edit config/routes/bolt.yaml
to add ../
to each of the resource:
's:
control_panel:
resource: '../../vendor/bolt/core/src/Controller/Backend/'
prefix: '%bolt.backend_url%'
type: annotation
# Async: Upload, Embed
control_panel_async:
resource: '../../vendor/bolt/core/src/Controller/Backend/Async'
prefix: '%bolt.backend_url%/async'
type: annotation
# ImageController, Currently only used for thumbnails
controllers:
resource: '../../vendor/bolt/core/src/Controller/ImageController.php'
type: annotation
If you get this error:
!! In AbstractRecursivePass.php line 153:
!!
!! Invalid service "Bolt\Controller\ExceptionController": class "Bolt\Controll
!! er\ExceptionController" does not exist
Replace the following lines in services.yaml
:
# Override Symfony's error pages (so we can show custom 404's)
Bolt\Controller\ExceptionController:
public: true
arguments:
$debug: '%kernel.debug%'
with:
Symfony\Component\ErrorHandler\ErrorRenderer\ErrorRendererInterface: '@error_handler.error_renderer.html'
Squirrel\TwigPhpSyntax\PhpSyntaxExtension: ~
Replace this line in packages/twig.yaml
:
exception_controller: Bolt\Controller\ExceptionController::showAction
with:
exception_controller: ~
Next, delete the file config/routes/dev/twig.yaml
And finally, in packages/framework.yaml
, add:
# Override Symfony's error controller, so we can show custom 404's and 503's
error_controller: Bolt\Controller\ErrorController::showAction
Uncaught …\ClassNotFoundException: Attempted to load class "DoctrineCacheBundle" / "WhiteOctoberPagerfantaBundle"
If you get this error:
!! Fatal error: Uncaught …\ClassNotFoundException: Attempted to load class "DoctrineCacheBundle" from namespace "Doctrine\Bundle\DoctrineCacheBundle".
!! Did you forget a "use" statement for another namespace? in /…/src/Kernel.php:32
!! Stack trace:
Or this error:
!! PHP Fatal error: Uncaught …\ClassNotFoundException: Attempted to load class "WhiteOctoberPagerfantaBundle" from namespace "WhiteOctober\PagerfantaBundle".
!! Did you forget a "use" statement for another namespace? in /…/src/Kernel.php:32
You can fix this by removing this line from config/bundles.php
:
Doctrine\Bundle\DoctrineCacheBundle\DoctrineCacheBundle::class => ['all' => true],
…
WhiteOctober\PagerfantaBundle\WhiteOctoberPagerfantaBundle::class => ['all' => true],
If you get this error:
Script cache:clear returned with error code 255
!! PHP Fatal error: Uncaught Error: Class 'WhiteOctober\PagerfantaBundle\WhiteOctoberPagerfantaBundle'
!! not found in site/vendor/bolt/core/src/Kernel.php:32
!! Stack trace:
Edit config/bundles.php
, and replace
WhiteOctober\PagerfantaBundle\WhiteOctoberPagerfantaBundle::class => ['all' => true],
with
BabDev\PagerfantaBundle\BabDevPagerfantaBundle::class => ['all' => true],
If you get this error when saving a record:
Call to a member function setLocale() on array
or, if collection items are not visible after saving them
Update services.yaml, add the 3 lines below:
Bolt\Event\Listener\FieldFillListener:
tags:
- { name: doctrine.event_listener, event: postLoad }
If you get this error:
Cannot autowire service "Bolt\Canonical": argument "$defaultLocale" of meth
!! od "__construct()" is type-hinted "string", you should configure its value
!! explicitly.
Update services.yaml, add the line with $defaultLocale
:
services:
_defaults:
…
bind:
$locales: '%app_locales%'
$defaultLocale: '%locale%'
…
If you get this error:
Cannot autowire service "Bolt\Command\CopyAssetsCommand": argument "$public
!! Folder" of method "__construct()" is type-hinted "string", you should confi
!! gure its value explicitly.
Update services.yaml, add the line with $publicFolder
:
services:
_defaults:
…
bind:
…
$publicFolder: '%bolt.public_folder%'
$tablePrefix: '%bolt.table_prefix%'
If you get this error:
Unable to find file "@TranslationBundle/Resources/config/routing_webui.yml" in
@TranslationBundle/Resources/config/routing_webui.yml (which is being imported
from "/Users/bob/Sites/Bolt/standard-project/config/routes/translation.yml").
Update config/routes/translation.yml
:
resource: "@TranslationBundle/Resources/config/routing_webui.yaml"
and config/routes/dev/translation.yml
:
resource: '@TranslationBundle/Resources/config/routing_symfony_profiler.yaml'
In both cases, you just need to update .yml
to .yaml
If you get this error:
PHP Fatal error: Uncaught Symfony\Component\Debug\Exception\ClassNotFoundException: Attempted to load class "StofDoctrineExtensionsBundle" from namespace "Stof\DoctrineExtensionsBundle".
Or this error:
Specified non-existing directory "/…/vendor/gedmo/doctrine-extensions/lib/Gedmo/Translatable/Entity/MappedSuperclass"
as Doctrine mapping source.
Remove these two lines from config/services.yaml
:
doctrine.orm.entity_manager.class: Bolt\Doctrine\TranslatableEntityManager
stof_doctrine_extensions.listener.translatable.class: Bolt\Event\Listener\PreTranslatableListener
In config/bundles.php
, remove one line, and add another. Remove:
Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle::class => ['all' => true],
and replace it with:
Knp\DoctrineBehaviors\Bundle\DoctrineBehaviorsBundle::class => ['all' => true],
Then, delete the file config/packages/stof_doctrine_extensions.yaml
Then, in config/packages/doctrine.yaml
, remove these sections:
gedmo_translatable:
type: annotation
prefix: Gedmo\Translatable\Entity
dir: "%kernel.project_dir%/vendor/gedmo/doctrine-extensions/lib/Gedmo/Translatable/Entity/MappedSuperclass"
is_bundle: false
gedmo_translator:
type: annotation
prefix: Gedmo\Translator\Entity
dir: "%kernel.project_dir%/vendor/gedmo/doctrine-extensions/lib/Gedmo/Translator/Entity"
is_bundle: false
If you get this error:
Notice: Undefined index: location
You can fix this by adding the following to your config/services.yaml
:
monolog.processor.request:
class: Bolt\Log\RequestProcessor
tags:
- { name: monolog.processor, method: processRecord, handler: db }
Create a new file config/packages/monolog.yaml
, to configure the new logging:
monolog:
channels: ['db']
handlers:
db:
channels: ['db']
type: service
id: Bolt\Log\LogHandler
If your database is out of date, you get this error:
An exception occurred while executing '…' with params […]:
SQLSTATE[HY000]: General error:
Run the following to update it (by force):
bin/console doctrine:schema:update --force
If you get this error:
Cannot autowire service "Bolt\Event\Subscriber\TimedPublishSubscriber": argument "$prefix" of method "__construct()" is type-hinted "string", you should
configure its value explicitly.
You can fix this by adding the following to your config/services.yaml
:
Bolt\Event\Subscriber\TimedPublishSubscriber:
arguments: [ "%bolt.table_prefix%" ]