From aab9d6b6f3adf6f75f29a14d286a402e8ea4d1d2 Mon Sep 17 00:00:00 2001 From: Maxime Veber Date: Wed, 31 Jul 2019 21:19:48 +0200 Subject: [PATCH] Melodiia integration Decorates a class of Melodiia. Adds Symfony auto-detection and registration of corresponding service decoratin. --- composer.json | 3 +- .../Melodiia/DomainObjectsDataMapper.php | 42 +++++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 src/Integration/Melodiia/DomainObjectsDataMapper.php diff --git a/composer.json b/composer.json index 0a77837..ed8c7e8 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,8 @@ "doctrine/orm": "^2.6.3", "friendsofphp/php-cs-fixer": "^2.14", "doctrine/doctrine-bundle": "^1.8", - "symfony/symfony": "^4.3|^5.0" + "symfony/symfony": "^4.3|^5.0", + "biig/melodiia": "@dev" }, "conflict": { "doctrine/orm": "<2.6.3" diff --git a/src/Integration/Melodiia/DomainObjectsDataMapper.php b/src/Integration/Melodiia/DomainObjectsDataMapper.php new file mode 100644 index 0000000..c63d2c0 --- /dev/null +++ b/src/Integration/Melodiia/DomainObjectsDataMapper.php @@ -0,0 +1,42 @@ +decorated = $dataMapper; + $this->dispatcher = $dispatcher; + } + + public function createObject(iterable $form, string $dataClass = null) + { + $object = parent::createObject($form, $dataClass); + + if ($object instanceof DomainModel) { + $object->setDispatcher($this->dispatcher); + } + + return $object; + } +}