Skip to content

Commit

Permalink
#5 The Symfony Serializer Component added.
Browse files Browse the repository at this point in the history
`composer require symfony/serializer`
  • Loading branch information
automatix committed Apr 24, 2018
1 parent c03d6b0 commit 18531d0
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"symfony/framework-bundle": "^4.0",
"symfony/lts": "^4@dev",
"symfony/orm-pack": "^1.0",
"symfony/serializer": "^4.0",
"symfony/twig-bundle": "^4.0",
"symfony/yaml": "^4.0"
},
Expand Down
3 changes: 3 additions & 0 deletions config/dependencies/common.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

use App\Base\Utils\CamelCaseToSnakeCaseNameConverter;
use App\Base\Utils\NameConverterInterface;
use App\Services\Dummy\External\FooBService;
use App\Services\Dummy\External\FooServiceInterface;
use App\Services\Dummy\Internal\BarService;
Expand All @@ -14,6 +16,7 @@
$commonDependencies = [
FooServiceInterface::class => DI\autowire(FooBService::class),
BarServiceInterface::class => DI\autowire(BarService::class),
NameConverterInterface::class => DI\autowire(CamelCaseToSnakeCaseNameConverter::class),
EntityManagerInterface::class => function () {
$config = new Configuration();
$config->setMetadataDriverImpl(new AnnotationDriver(new AnnotationReader()));
Expand Down
10 changes: 10 additions & 0 deletions src/Base/Utils/CamelCaseToSnakeCaseNameConverter.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php
namespace App\Base\Utils;

use Symfony\Component\Serializer\NameConverter\CamelCaseToSnakeCaseNameConverter as SymfonyCamelCaseToSnakeCaseNameConverter;

class CamelCaseToSnakeCaseNameConverter extends SymfonyCamelCaseToSnakeCaseNameConverter implements NameConverterInterface
{


}
10 changes: 10 additions & 0 deletions src/Base/Utils/NameConverterInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php
namespace App\Base\Utils;

use Symfony\Component\Serializer\NameConverter\NameConverterInterface as SymfonyNameConverterInterface;

interface NameConverterInterface extends SymfonyNameConverterInterface
{


}
3 changes: 3 additions & 0 deletions symfony.lock
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,9 @@
"ref": "cda8b550123383d25827705d05a42acf6819fe4e"
}
},
"symfony/serializer": {
"version": "v4.0.8"
},
"symfony/twig-bridge": {
"version": "v4.0.6"
},
Expand Down

0 comments on commit 18531d0

Please sign in to comment.