Skip to content

Commit 83a1fe4

Browse files
committed
Exchange XMLFileLoader with YamlFileLoader
1 parent e54ce11 commit 83a1fe4

4 files changed

Lines changed: 90 additions & 75 deletions

File tree

README.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,6 @@ App\Provider\MyCustomProvider:
9494
- { name: shivas_versioning.provider, alias: my_provider, priority: 0 }
9595
```
9696
97-
```xml
98-
<service id="App\Provider\MyCustomProvider">
99-
<tag name="shivas_versioning.provider" alias="my_provider" priority="0" />
100-
</service>
101-
```
102-
10397
Please take a look at the priority attribute, it should be between 0 and 99 to keep the providers in the right order.
10498
10599
Ensure your provider is loaded correctly and supported:

src/DependencyInjection/ShivasVersioningExtension.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ final class ShivasVersioningExtension extends Extension
1414
*/
1515
public function load(array $configs, ContainerBuilder $container): void
1616
{
17-
$loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
18-
$loader->load('services.xml');
17+
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
18+
$loader->load('services.yaml');
1919
}
2020
}

src/Resources/config/services.xml

Lines changed: 0 additions & 67 deletions
This file was deleted.

src/Resources/config/services.yaml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# This file is the entry point to configure your own services.
2+
# Files in the packages/ subdirectory configure your dependencies.
3+
4+
# Put parameters here that don't need to change on each machine where the app is deployed
5+
# https://symfony.com/doc/current/best_practices.html#use-parameters-for-application-configuration
6+
parameters:
7+
8+
services:
9+
_defaults:
10+
public: false
11+
# autowire: true # Automatically injects dependencies in your services.
12+
# autoconfigure: true # Automatically registers your services as commands, event subscribers, etc.
13+
14+
# Aliases
15+
Shivas\VersioningBundle\Service\VersionManagerInterface: '@shivas_versioning.manager'
16+
Shivas\VersioningBundle\Formatter\FormatterInterface: '@shivas_versioning.formatter.git'
17+
Shivas\VersioningBundle\Writer\WriterInterface: '@shivas_versioning.writer.version'
18+
19+
# Services
20+
shivas_versioning.manager:
21+
class: Shivas\VersioningBundle\Service\VersionManager
22+
arguments:
23+
- '@shivas_versioning.cache.version'
24+
- '@Shivas\VersioningBundle\Writer\WriterInterface'
25+
- '@Shivas\VersioningBundle\Formatter\FormatterInterface'
26+
27+
shivas_versioning.formatter.git:
28+
class: Shivas\VersioningBundle\Formatter\GitDescribeFormatter
29+
30+
shivas_versioning.writer.version:
31+
class: Shivas\VersioningBundle\Writer\VersionWriter
32+
arguments: ['%kernel.project_dir%']
33+
34+
# Providers
35+
shivas_versioning.provider.version:
36+
class: Shivas\VersioningBundle\Provider\VersionProvider
37+
arguments: ['%kernel.project_dir%']
38+
tags:
39+
- { name: shivas_versioning.provider, alias: version, priority: 100 }
40+
41+
shivas_versioning.provider.git:
42+
class: Shivas\VersioningBundle\Provider\GitRepositoryProvider
43+
arguments: ['%kernel.project_dir%']
44+
tags:
45+
- { name: shivas_versioning.provider, alias: git, priority: -25 }
46+
47+
shivas_versioning.provider.revision:
48+
class: Shivas\VersioningBundle\Provider\RevisionProvider
49+
arguments: ['%kernel.project_dir%']
50+
tags:
51+
- { name: shivas_versioning.provider, alias: revision, priority: -50 }
52+
53+
shivas_versioning.provider.init:
54+
class: Shivas\VersioningBundle\Provider\InitialVersionProvider
55+
tags:
56+
- { name: shivas_versioning.provider, alias: init, priority: -75 }
57+
58+
# Cache
59+
shivas_versioning.cache.version:
60+
parent: cache.system
61+
tags:
62+
- { name: cache.pool }
63+
64+
# Commands
65+
shivas_versioning.command.status:
66+
class: Shivas\VersioningBundle\Command\StatusCommand
67+
arguments: ['@Shivas\VersioningBundle\Service\VersionManagerInterface']
68+
tags:
69+
- { name: console.command }
70+
71+
shivas_versioning.command.list_providers:
72+
class: Shivas\VersioningBundle\Command\ListProvidersCommand
73+
arguments: ['@Shivas\VersioningBundle\Service\VersionManagerInterface']
74+
tags:
75+
- { name: console.command }
76+
77+
shivas_versioning.command.version_bump:
78+
class: Shivas\VersioningBundle\Command\VersionBumpCommand
79+
arguments: ['@Shivas\VersioningBundle\Service\VersionManagerInterface']
80+
tags:
81+
- { name: console.command }
82+
83+
# Twig Extensions
84+
shivas_versioning.twig.version:
85+
class: Shivas\VersioningBundle\Twig\VersionExtension
86+
arguments: ['@Shivas\VersioningBundle\Service\VersionManagerInterface']
87+
tags:
88+
- { name: twig.extension }

0 commit comments

Comments
 (0)