I'm trying to deploy a Symfony project, but I get an error from GitLab CI/CD while clearing cache with Composer:
Executing script cache:clear [KO]
[KO]
Script cache:clear returned with error code 255
!!
!! Fatal error: Uncaught AssertionError: assert($mapping instanceof ManyToManyOwningSideMapping) in [path_to_build]/vendor/doctrine/orm/src/Mapping/AssociationMapping.php:125
!! Stack trace:
!! #0 [path_to_build]/vendor/doctrine/orm/src/Mapping/AssociationMapping.php(125): assert(false, 'assert($mapping...')
!! #1 [path_to_build]/vendor/doctrine/orm/src/Mapping/ClassMetadata.php(1403): Doctrine\ORM\Mapping\AssociationMapping::fromMappingArray(Array)
!! #2 [path_to_build]/vendor/doctrine/orm/src/Mapping/ClassMetadata.php(1980): Doctrine\ORM\Mapping\ClassMetadata->_validateAndCompleteAssociationMapping(Array)
!! #3 [path_to_build]/vendor/doctrine/orm/src/Mapping/Driver/AttributeDriver.php(458): Doctrine\ORM\Mapping\ClassMetadata->mapManyToMany(Array)
!! #4 [path_to_build]/vendor/doctrine/persistence/src/Persistence/Mapping/Driver/MappingDriverChain.php(77): Doctrine\ORM\Mapping\Driver\AttributeDriver->loadMetadataForClass('App\\Entity\\Arti...', Object(Doctrine\ORM\Mapping\ClassMetadata))
!! #5 [path_to_build]/vendor/doctrine/doctrine-bundle/Mapping/MappingDriver.php(42): Doctrine\Persistence\Mapping\Driver\MappingDriverChain->loadMetadataForClass('App\\Entity\\Arti...', Object(Doctrine\ORM\Mapping\ClassMetadata))
!! #6 [path_to_build]/vendor/doctrine/orm/src/Mapping/ClassMetadataFactory.php(163): Doctrine\Bundle\DoctrineBundle\Mapping\MappingDriver->loadMetadataForClass('App\\Entity\\Arti...', Object(Doctrine\ORM\Mapping\ClassMetadata))
!! #7 [path_to_build]/vendor/doctrine/doctrine-bundle/Mapping/ClassMetadataFactory.php(18): Doctrine\ORM\Mapping\ClassMetadataFactory->doLoadMetadata(Object(Doctrine\ORM\Mapping\ClassMetadata), NULL, false, Array)
!! #8 [path_to_build]/vendor/doctrine/persistence/src/Persistence/Mapping/AbstractClassMetadataFactory.php(343): Doctrine\Bundle\DoctrineBundle\Mapping\ClassMetadataFactory->doLoadMetadata(Object(Doctrine\ORM\Mapping\ClassMetadata), NULL, false, Array)
!! #9 [path_to_build]/vendor/doctrine/persistence/src/Persistence/Mapping/AbstractClassMetadataFactory.php(207): Doctrine\Persistence\Mapping\AbstractClassMetadataFactory->loadMetadata('App\\Entity\\Arti...')
!! #10 [path_to_build]/vendor/doctrine/persistence/src/Persistence/Mapping/AbstractClassMetadataFactory.php(96): Doctrine\Persistence\Mapping\AbstractClassMetadataFactory->getMetadataFor('App\\Entity\\Arti...')
!! #11 [path_to_build]/vendor/doctrine/doctrine-bundle/CacheWarmer/DoctrineMetadataCacheWarmer.php(48): Doctrine\Persistence\Mapping\AbstractClassMetadataFactory->getAllMetadata()
!! #12 [path_to_build]/vendor/symfony/framework-bundle/CacheWarmer/AbstractPhpFileCacheWarmer.php(43): Doctrine\Bundle\DoctrineBundle\CacheWarmer\DoctrineMetadataCacheWarmer->doWarmUp('/home/xemaro/bu...', Object(Symfony\Component\Cache\Adapter\ArrayAdapter), '/home/xemaro/bu...')
!! #13 [path_to_build]/vendor/symfony/http-kernel/CacheWarmer/CacheWarmerAggregate.php(99): Symfony\Bundle\FrameworkBundle\CacheWarmer\AbstractPhpFileCacheWarmer->warmUp('/home/xemaro/bu...', '/home/xemaro/bu...')
!! #14 [path_to_build]/vendor/symfony/http-kernel/Kernel.php(527): Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerAggregate->warmUp('/home/xemaro/bu...', '/home/xemaro/bu...')
!! #15 [path_to_build]/vendor/symfony/http-kernel/Kernel.php(725): Symfony\Component\HttpKernel\Kernel->initializeContainer()
!! #16 [path_to_build]/vendor/symfony/http-kernel/Kernel.php(123): Symfony\Component\HttpKernel\Kernel->preBoot()
!! #17 [path_to_build]/vendor/symfony/framework-bundle/Console/Application.php(179): Symfony\Component\HttpKernel\Kernel->boot()
!! #18 [path_to_build]/vendor/symfony/framework-bundle/Console/Application.php(71): Symfony\Bundle\FrameworkBundle\Console\Application->registerCommands()
!! #19 [path_to_build]/vendor/symfony/console/Application.php(169): Symfony\Bundle\FrameworkBundle\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
!! #20 [path_to_build]/vendor/symfony/runtime/Runner/Symfony/ConsoleApplicationRunner.php(49): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
!! #21 [path_to_build]/vendor/autoload_runtime.php(29): Symfony\Component\Runtime\Runner\Symfony\ConsoleApplicationRunner->run()
!! #22 [path_to_build]/bin/console(11): require_once('/home/xemaro/bu...')
!! #23 {main}
!! thrown in [path_to_build]/vendor/doctrine/orm/src/Mapping/AssociationMapping.php on line 125
!!
Script @auto-scripts was called via post-install-cmd
Running after_script
dircolors: no SHELL environment variable, and no shell type option given
Uploading artifacts for failed job
dircolors: no SHELL environment variable, and no shell type option given
ERROR: Job failed: exit status 1
Here's my files:
composer.json
{
"type": "project",
"license": "proprietary",
"minimum-stability": "stable",
"prefer-stable": true,
"require": {
"php": ">=8.3",
"ext-ctype": "*",
"ext-iconv": "*",
"doctrine/doctrine-bundle": "^2.11",
"doctrine/doctrine-migrations-bundle": "^3.3",
"doctrine/orm": "^3.1",
"friendsofsymfony/jsrouting-bundle": "^3.5",
"jwilsson/spotify-web-api-php": "^6.0",
"symfony/console": "7.0.*",
"symfony/dotenv": "7.0.*",
"symfony/flex": "^2.4",
"symfony/framework-bundle": "7.0.*",
"symfony/runtime": "7.0.*",
"symfony/security-bundle": "7.0.*",
"symfony/twig-bundle": "7.0.*",
"symfony/webpack-encore-bundle": "^2.1",
"symfony/yaml": "7.0.*"
},
"require-dev": {
"phpunit/phpunit": "^10.5",
"psalm/plugin-phpunit": "^0.19",
"psalm/plugin-symfony": "^5.1",
"symfony/browser-kit": "7.0.*",
"symfony/css-selector": "7.0.*",
"symfony/maker-bundle": "^1.56",
"symfony/phpunit-bridge": "7.0.*",
"symfony/stopwatch": "7.0.*",
"symfony/web-profiler-bundle": "7.0.*",
"vimeo/psalm": "^5.23"
},
"config": {
"allow-plugins": {
"php-http/discovery": true,
"symfony/flex": true,
"symfony/runtime": true
},
"sort-packages": true
},
"autoload": {
"psr-4": {
"App\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"App\\Tests\\": "tests/"
}
},
"replace": {
"symfony/polyfill-ctype": "*",
"symfony/polyfill-iconv": "*",
"symfony/polyfill-php72": "*",
"symfony/polyfill-php73": "*",
"symfony/polyfill-php74": "*",
"symfony/polyfill-php80": "*",
"symfony/polyfill-php81": "*",
"symfony/polyfill-php82": "*",
"symfony/polyfill-php83": "*"
},
"scripts": {
"auto-scripts": {
"cache:clear": "symfony-cmd",
"assets:install %PUBLIC_DIR%": "symfony-cmd"
},
"post-install-cmd": [
"@auto-scripts"
],
"post-update-cmd": [
"@auto-scripts"
]
},
"conflict": {
"symfony/symfony": "*"
},
"extra": {
"symfony": {
"allow-contrib": false,
"require": "7.0.*"
}
}
}
.gitlab-ci.yml
default:
image: php:8.3
stages:
- deploy
deploy-prod:
stage: deploy
environment:
name: production
only:
- dev
before_script:
- git submodule update --init --recursive
- export APP_ENV=prod APP_DEBUG=0 YARN_ENABLE_IMMUTABLE_INSTALLS=false DATABASE_URL=$DATABASE_URL
- composer2 install --no-dev --prefer-dist --optimize-autoloader # My web host gives composer for v1 and composer2 for v2
- php bin/console assets:install --symlink public
- yarn config set enableStrictSsl true
- yarn install
- yarn encore production
- php bin/console cache:clear
- rm -Rf $HOME/$PRODUCTION_PATH/node_modules/
- rm -Rf $HOME/$PRODUCTION_PATH/var/
- rm -Rf $HOME/$PRODUCTION_PATH/vendor/
script:
- php bin/console doctrine:migrations:migrate
- rm -Rf .yarn/
- rm -Rf assets/
- rm -Rf bin/
- rm -Rf migrations/
- rm -Rf tests/
- rm -Rf .env.test
- rm -Rf .gitattributes
- rm -Rf .gitmodules
- rm -Rf .phpunit.result.cache
- rm -Rf .yarnrc.yml
- rm -Rf composer.json
- rm -Rf composer.lock
- rm -Rf package.json
- rm -Rf package-lock.json
- rm -Rf phpunit.xml.dist
- rm -Rf psalm.xml
- rm -Rf README.md
- rm -Rf symfony.lock
- rm -Rf webpack.config.js
- rm -Rf yarn.lock
- cd ../
- rsync -auO $REPO_NAME/ $HOME/$PRODUCTION_PATH/ --include=public/dist --include=public/.htaccess --include=vendor --exclude-from=$REPO_NAME/.gitignore --exclude=".*"
Is there anything I can do to clear this error?