https://github.com/jdecool/doctrine-nullable-embeddable
Implement nullable embeddables in Doctrine entities
https://github.com/jdecool/doctrine-nullable-embeddable
Last synced: 4 months ago
JSON representation
Implement nullable embeddables in Doctrine entities
- Host: GitHub
- URL: https://github.com/jdecool/doctrine-nullable-embeddable
- Owner: jdecool
- License: mit
- Created: 2024-05-08T13:41:34.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-05-10T19:17:36.000Z (about 1 year ago)
- Last Synced: 2025-03-05T22:30:39.007Z (4 months ago)
- Language: PHP
- Size: 7.81 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
DoctrineNullableEmbeddable
==========================[](https://actions-badge.atrox.dev/jdecool/doctrine-nullable-embeddable/goto?ref=main)
[](https://packagist.org/packages/jdecool/doctrine-nullable-embeddable)Implement nullable embeddables in Doctrine entities
## Install it
Install the extension using [Composer](https://getcomposer.org):
```bash
$ composer require jdecool/doctrine-nullable-embeddable
```## Available attributes
* `JDecool\DoctrineNullableEmbeddable\Attribute\NullableEmbeddable`
* `JDecool\DoctrineNullableEmbeddable\Attribute\NullableEmbedded`## Register the mapping listener
Nullable Doctrine embeddables can be automatically managed by reigster the `JDecool\DoctrineNullableEmbeddable\Listener\MappingListener` listener class.
```php
$configuration = new Configuration();
// ...$entityManager = EntityManager::create(['driver' => 'pdo_sqlite', 'memory' => true], $configuration);
$eventManager = $entityManager->getEventManager();
$eventManager->addEventListener(['loadClassMetadata'], new MappingListener());
```## Register entity listener manually
Or you can manually register the `JDecool\DoctrineNullableEmbeddable\Listener\NullableEmbeddableListener` on an entity.