doctrine / doctrine/DoctrineBundle
Problem with JSON column
- Dominant language
- PHP
- Stars
- 4.8k
- Forks
- 482
- Avg merge
- 1h 51m
- Merged PRs (30d)
- 3
Description
### Bug Report
| Q | A
|-------------------------------------------- | ------
| doctrine-bundle | 3.3.1
|doctrine/doctrine-migrations-bundle" | "^4.0",
|PHP Version | 8.4
#### Summary
Doctrine crashed after created a table with JSON
#### Current behavior
```
root@e3f8cd825c7a:/var/www/html# php bin/console doctrine:migration:diff
[critical] Error thrown while running command "'doctrine:migration:diff'". Message: "assert($options !== null)"
[critical] Uncaught Error: assert($options !== null)
In AbstractSchemaManager.php line 661:
assert($options !== null )
```
#### Expected behavior
It should works ?
#### How to reproduce
In my scenario
I create a simple entity called `test`
```
class MyEntity
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
#[Groups(['get'])]
private ?int $id = null;
#[ORM\Column(type: 'json')]
#[Groups(['get', 'patch'])]
private array $domains = [];
}
```
Then, i try to generate a diff and apply it
```
root@b7e3ffb21f00:/var/www/html# php bin/console doctrine:migration:diff
Generated new migration class to "/var/www/html/migrations/Version20260728055728.php"
To run just this migration for testing purposes, you can use migrations:execute --up "DoctrineMigrations\\Version20260728055728"
To revert the migration you can use migrations:execute --down "DoctrineMigrations\\Version20260728055728"
root@b7e3ffb21f00:/var/www/html# php bin/console doctrine:migration:migrate
WARNING! You are about to execute a migration in database "app" that could result in schema changes and data loss. Are you sure you wish to continue? (yes/no) [yes]:
> yes
[notice] Migrating up to DoctrineMigrations\Version20260728055728
[notice] finished in 4.8ms, used 22M memory, 1 migrations executed, 1 sql queries
[OK] Successfully migrated to version: DoctrineMigrations\Version20260728055728
root@b7e3ffb21f00:/var/www/html# php bin/console doctrine:migration:diff
[critical] Error thrown while running command "'doctrine:migration:diff'". Message: "assert($options !== null)"
[critical] Uncaught Error: assert($options !== null)
In AbstractSchemaManager.php line 661:
assert($options !== null)
```
Contributor guide
Research direction
Reproduce the failure with the shown JSON column entity by running doctrine:migration:diff after applying the generated migration. Start at AbstractSchemaManager.php line 661 and trace the schema comparison that leaves $options null. Done means the second diff completes without the assertion while preserving correct JSON-column handling.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend, database
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100