Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Allow to override the data mapper of the api type #78

Merged
merged 2 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [0.10.4] 2024-06-25

### Added
- Fix version for Symfony 7 #79
- Add support for any version of Symfony 7 #79
- Make the Melodiia data mapper a service so it's overridable more easily globally #78

## [0.10.3] 2024-06-04

Expand Down
2 changes: 2 additions & 0 deletions src/DependencyInjection/MelodiiaExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ public function load(array $configs, ContainerBuilder $container)
if ($container->hasAlias('melodiia.data_provider')) {
$loader->load('crud.yaml');
}

$loader->load('form.yaml');
}

if (class_exists(Environment::class)) {
Expand Down
9 changes: 9 additions & 0 deletions src/Resources/config/form.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
services:
melodiia.form.data_mapper:
class: SwagIndustries\Melodiia\Form\DomainObjectsDataMapper

SwagIndustries\Melodiia\Form\Type\ApiType:
arguments:
$dataMapper: '@melodiia.form.data_mapper'
tags:
- { name: 'form.type' }
Loading