sbooker / doctrine-object-mapping
Doctrine object types mapping support
Installs: 4 388
Dependents: 1
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: >=8.2
- ext-json: *
- doctrine/dbal: ^3.0
- symfony/http-kernel: ^6.4 | ^7.0
- symfony/serializer: ^6.4 | ^7.0
Requires (Dev)
- phpunit/phpunit: ^9.1 || ^10.0
This package is auto-updated.
Last update: 2024-10-22 15:50:39 UTC
README
Maps immutable object and object list to single json field.
Installation
Make sure Composer is installed globally, as explained in the installation chapter of the Composer documentation.
Applications that don't use Symfony
Step 1: Download library
$ composer require sbooker/doctrine-object-mapping
Step 2: Create and register Doctrine type
class Concrete { /* ... */ } class ConcreteType extends \Sbooker\DoctrineObjectMapping\ObjectType { protected function getObjectClass(): string { return Concrete::class; } public function getName() { return 'concrete'; } } \Doctrine\DBAL\Types\Type::addType('concrete', ConcreteType::class); // Create or get normalizer $normalizer = new \Symfony\Component\Serializer\Normalizer\ObjectNormalizer(/*...*/); // Set serializer to type on boot application /** @var \Sbooker\DoctrineObjectMapping\NormalizableType $type */ $type = \Doctrine\DBAL\Types\Type::getType('concrete'); $type->setNormalizer($normalizer); $type->setDenormalizer($normalizer);
Applications that use Symfony
Use sbooker/doctrine-object-mapping-bundle
License
See LICENSE file.