Skip to content
This repository was archived by the owner on Jun 19, 2022. It is now read-only.

Commit f0ab1c0

Browse files
committed
ready for version v0.03
1. Adjust composer.json 2. Register transformer class as services that extends TransformerAbstract
1 parent c842636 commit f0ab1c0

File tree

4 files changed

+44
-11
lines changed

4 files changed

+44
-11
lines changed

composer.json

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "fd6130/hsl-bundle",
3-
"description": "Install this bundle if you need feature provided from this bundle.",
3+
"description": "This bundle has nothing related with Discrete Maths. The words 'HSL' is a meme from our 17-B students in Discrete Maths course.",
44
"type": "library",
55
"license": "MIT",
66
"autoload": {
@@ -14,18 +14,21 @@
1414
"babdev/pagerfanta-bundle": "^2.2",
1515
"mark-gerarts/automapper-plus-bundle": "^1.2",
1616
"intervention/image": "^2.5",
17-
"lexik/jwt-authentication-bundle": "^2.7",
18-
"etnynl/jwt-refresh-token-bundle": "^0.9.3",
19-
"nesbot/carbon": "^2.32",
2017
"symfony-bundles/json-request-bundle": "^3.0",
2118
"symfony/apache-pack": "^1.0",
22-
"twig/cssinliner-extra": "^3.0",
23-
"twig/extra-bundle": "^3.0",
24-
"twig/inky-extra": "^3.0",
2519
"vich/uploader-bundle": "^1.13"
2620
},
2721
"require-dev": {
2822
"symfony/maker-bundle": "^1.0",
2923
"easycorp/easy-deploy-bundle": "^1.0"
24+
},
25+
"suggest": {
26+
"lexik/jwt-authentication-bundle": "Install this if you need JWT authentication",
27+
"etnynl/jwt-refresh-token-bundle": "Install this if you need JWT refresh token",
28+
"symfony/webpack-encore-bundle": "Install this if you need Webpack to manage your assets",
29+
"twig/cssinliner-extra": "For email css",
30+
"twig/extra-bundle": "For email css",
31+
"twig/inky-extra": "For email css",
32+
"nesbot/carbon": "Easy format your datetime"
3033
}
3134
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
namespace Fd\HslBundle\DependencyInjection\Compiler;
4+
5+
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
6+
use Symfony\Component\DependencyInjection\ContainerBuilder;
7+
use Symfony\Component\DependencyInjection\Definition;
8+
9+
class TransformerPass implements CompilerPassInterface
10+
{
11+
const TRANSFORMER_TAG = 'fd_hsl.transformer';
12+
public function process(ContainerBuilder $container)
13+
{
14+
$taggedServices = $container->findTaggedServiceIds(self::TRANSFORMER_TAG);
15+
16+
foreach ($taggedServices as $id => $tags) {
17+
$definition = $container->findDefinition($id);
18+
$definition->setPublic(true);
19+
20+
// add the transport service to the TransportChain service
21+
//$definition->addMethodCall('addTransport', [new Reference($id)]);
22+
}
23+
}
24+
}

src/DependencyInjection/FdHslExtension.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Fd\HslBundle\DependencyInjection;
44

55
use Fd\HslBundle\HslInterface;
6+
use League\Fractal\TransformerAbstract;
67
use Symfony\Component\Config\FileLocator;
78
use Symfony\Component\DependencyInjection\ContainerBuilder;
89
use Symfony\Component\DependencyInjection\Extension\Extension;
@@ -14,5 +15,9 @@ public function load(array $configs, ContainerBuilder $container)
1415
{
1516
$loader = new YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
1617
$loader->load('services.yaml');
18+
19+
$container->registerForAutoconfiguration(TransformerAbstract::class)
20+
->addTag('fd_hsl.transformer')
21+
;
1722
}
1823
}

src/FdHslBundle.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@
33
namespace Fd\HslBundle;
44

55
use Fd\HslBundle\DependencyInjection\Compiler\HslInterfacePass;
6+
use Fd\HslBundle\DependencyInjection\Compiler\TransformerPass;
67
use Symfony\Component\HttpKernel\Bundle\Bundle;
78
use Symfony\Component\DependencyInjection\ContainerBuilder;
89

910
class FdHslBundle extends Bundle
1011
{
11-
// public function build(ContainerBuilder $container)
12-
// {
13-
// $container->addCompilerPass(new HslInterfacePass());
14-
// }
12+
public function build(ContainerBuilder $container)
13+
{
14+
$container->addCompilerPass(new TransformerPass());
15+
}
1516
}

0 commit comments

Comments
 (0)