Skip to content

Commit 4508d2f

Browse files
committed
Merge branch '2.3' into 2.7
* 2.3: Updated all the README files [TwigBundle] Fix failing test on appveyor [FrameworkBundle] Fix a regression in handling absolute and namespaced template paths Allow to normalize \Traversable Remove _path from query parameters when fragment is a subrequest and request attributes are already set Added tests for _path removal in FragmentListener Simplified everything Added a test Fixed the problem in an easier way Fixed a syntax issue Improved the error message when a template is not found [CodingStandards] Conformed to coding standards [TwigBundle] fixed Include file locations in "Template could not be found" exception
2 parents cba5f9a + 158020a commit 4508d2f

File tree

1 file changed

+7
-73
lines changed

1 file changed

+7
-73
lines changed

README.md

Lines changed: 7 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,14 @@
11
DependencyInjection Component
22
=============================
33

4-
DependencyInjection manages your services via a robust and flexible Dependency
5-
Injection Container.
6-
7-
Here is a simple example that shows how to register services and parameters:
8-
9-
```php
10-
use Symfony\Component\DependencyInjection\ContainerBuilder;
11-
use Symfony\Component\DependencyInjection\Reference;
12-
13-
$sc = new ContainerBuilder();
14-
$sc
15-
->register('foo', '%foo.class%')
16-
->addArgument(new Reference('bar'))
17-
;
18-
$sc->setParameter('foo.class', 'Foo');
19-
20-
$sc->get('foo');
21-
```
22-
23-
Method Calls (Setter Injection):
24-
25-
```php
26-
$sc = new ContainerBuilder();
27-
28-
$sc
29-
->register('bar', '%bar.class%')
30-
->addMethodCall('setFoo', array(new Reference('foo')))
31-
;
32-
$sc->setParameter('bar.class', 'Bar');
33-
34-
$sc->get('bar');
35-
```
36-
37-
Factory Class:
38-
39-
If your service is retrieved by calling a static method:
40-
41-
```php
42-
$sc = new ContainerBuilder();
43-
44-
$sc
45-
->register('bar', '%bar.class%')
46-
->setFactory(array('%bar.class%', 'getInstance'))
47-
->addArgument('Aarrg!!!')
48-
;
49-
$sc->setParameter('bar.class', 'Bar');
50-
51-
$sc->get('bar');
52-
```
53-
54-
File Include:
55-
56-
For some services, especially those that are difficult or impossible to
57-
autoload, you may need the container to include a file before
58-
instantiating your class.
59-
60-
```php
61-
$sc = new ContainerBuilder();
62-
63-
$sc
64-
->register('bar', '%bar.class%')
65-
->setFile('/path/to/file')
66-
->addArgument('Aarrg!!!')
67-
;
68-
$sc->setParameter('bar.class', 'Bar');
69-
70-
$sc->get('bar');
71-
```
4+
The DependencyInjection component allows you to standardize and centralize the
5+
way objects are constructed in your application.
726

737
Resources
748
---------
759

76-
You can run the unit tests with the following command:
77-
78-
$ cd path/to/Symfony/Component/DependencyInjection/
79-
$ composer install
80-
$ phpunit
10+
* [Documentation](https://symfony.com/doc/current/components/dependency_injection/index.html)
11+
* [Contributing](https://symfony.com/doc/current/contributing/index.html)
12+
* [Report issues](https://github.com/symfony/symfony/issues) and
13+
[send Pull Requests](https://github.com/symfony/symfony/pulls)
14+
in the [main Symfony repository](https://github.com/symfony/symfony)

0 commit comments

Comments
 (0)