Repository navigation
feat: add jsonb_document type for DBAL 4.3.0+ - #155
Conversation
34ad85f to
3532d76
Compare
f327692 to
d679dc7
Compare
|
@dunglas I tried something here, not sure it is the right think to do. |
|
|
||
| namespace Dunglas\DoctrineJsonOdm\Tests; | ||
|
|
||
| use Doctrine\DBAL\Types\JsonbType; |
There was a problem hiding this comment.
It seems this class is not used in this file.
There was a problem hiding this comment.
Yes totaly, good catch
|
Could you please rebase? This should also fix the CI. |
New jsonb_document type leveraging native DBAL JsonbType. Shared serialization logic extracted into JsonDocumentTypeTrait. Type is conditionally registered when DBAL 4.3.0+ is available. # Conflicts: # tests/Fixtures/AppKernel.php
Move ProductJsonb entity to separate directory with conditional mapping. Enable native lazy objects for PHP 8.4+ compatibility.
bcdd7a4 to
e5bfc90
Compare
e5bfc90 to
902d7cf
Compare
|
@dunglas done ✅ |
There was a problem hiding this comment.
Pull request overview
This PR adds support for the native JSONB type introduced in Doctrine DBAL 4.3.0+ by creating a new jsonb_document type that leverages the JsonbType class. The implementation ensures backward compatibility by conditionally registering the new type only when DBAL 4.3.0+ is available.
Key changes:
- Extracted shared serialization logic into
JsonDocumentTypeTraitto avoid code duplication - Added
JsonbDocumentTypeclass that extends DBAL's nativeJsonbTypeand uses the shared trait - Conditionally registered the new type based on DBAL version availability
- Updated test entities to use the new type when available
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/Type/JsonDocumentTypeTrait.php | New trait extracting common serialization logic from JsonDocumentType to be shared with JsonbDocumentType |
| src/Type/JsonbDocumentType.php | New type class extending DBAL's JsonbType to support native JSONB with object serialization |
| src/Type/JsonDocumentType.php | Refactored to use the new shared trait, removing duplicated code |
| src/Bundle/DunglasDoctrineJsonOdmBundle.php | Added conditional registration of jsonb_document type and serializer injection |
| tests/Fixtures/TestBundle/Entity/Product.php | Updated to conditionally use jsonb_document type when DBAL 4.3.0+ is available |
| tests/Fixtures/TestBundle/Entity/Foo.php | Updated to conditionally use jsonb_document type when DBAL 4.3.0+ is available |
| README.md | Added documentation for the new jsonb_document type and updated usage examples |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Thanks! |
Adds a new
jsonb_documentDoctrine type that leverages DBAL 4.3.0+ nativeJsonbType.The type is conditionally registered only when DBAL 4.3.0+ is available, ensuring backward compatibility.
Shared serialization logic has been extracted into a trait to avoid duplication.
Closes #152
This is my first contribution to this project, hope I did it right! 🙂