Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jdecool/doctrine-nullable-embeddable
Implement nullable embeddables in Doctrine entities
https://github.com/jdecool/doctrine-nullable-embeddable
Last synced: about 2 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 (8 months ago)
- Default Branch: main
- Last Pushed: 2024-05-10T19:17:36.000Z (8 months ago)
- Last Synced: 2024-09-16T11:17:43.551Z (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
==========================[![Build Status](https://github.com/jdecool/doctrine-nullable-embeddable/actions/workflows/ci.yml/badge.svg)](https://actions-badge.atrox.dev/jdecool/doctrine-nullable-embeddable/goto?ref=main)
[![Latest Stable Version](https://poser.pugx.org/jdecool/doctrine-nullable-embeddable/v/stable.png)](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.