I’m trying to load fixtures in my Symfony project using the command:
symfony console doctrine:fixtures:load
However, I’m encountering the following error:
Careful, database "gestionexams" will be purged. Do you want to continue? (yes/no) [no]:
> yes
> purging database
> loading App\DataFixtures\AppFixtures
In ExceptionConverter.php line 115:
An exception occurred while executing a query: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'semestre_id' cannot be null
In Exception.php line 24:
SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'semestre_id' cannot be null
In Statement.php line 130:
SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'semestre_id' cannot be null
doctrine:fixtures:load [--append] [--group GROUP] [--em EM] [--purger PURGER] [--purge-exclusions PURGE-EXCLUSIONS] [--purge-with-truncate]
What I’ve Tried:
- Checked Database Server Status: Confirmed that MySQL/PostgreSQL is running.
- Verified
.env
Configuration: My.env
file contains:
DATABASE_URL="mysql://root:@127.0.0.1:3306/GestionExams?serverVersion=10.4.21-MariaDB&charset=utf8mb4"
- Tested Database Connection: I can connect to the database using a database client MySQL
- Cleared Symfony Cache: i run
php bin/console cache:clear
to ensure the cache isn’t causing the issue.
Additional Information:
DATABASE_URL="mysql://root:@127.0.0.1:3306/GestionExams?serverVersion=10.4.21-MariaDB&charset=utf8mb4"
- this my (repo)[https://github.com/marouane-sadoune/GEXAMS] repo