Changeset 19714
- Timestamp:
- 06/30/09 18:07:14 (7 months ago)
- Files:
-
- components/dependency_injection/trunk/doc/06-Speed.markdown (modified) (5 diffs)
- components/dependency_injection/trunk/doc/A-XML-Format.markdown (modified) (3 diffs)
- components/dependency_injection/trunk/doc/B-YAML-Format.markdown (modified) (3 diffs)
- components/dependency_injection/trunk/doc/C-INI-Format.markdown (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
components/dependency_injection/trunk/doc/06-Speed.markdown
r19700 r19714 8 8 9 9 But with the introduction of the XML and YAML configuration files, you might 10 have bec ame a bit scepticabout the performance of the container itself. Even10 have become a bit sceptical about the performance of the container itself. Even 11 11 if services are lazy loading, reading a bunch of XML or YAML files on each 12 12 request and creating objects by using introspection is probably not very 13 efficient in PHP. And because the container is almost always the corner stone13 efficient in PHP. And because the container is almost always the cornerstone 14 14 of any application using it, its speed does matter a lot. 15 15 16 On theone hand, using XML or YAML to describe services and their16 On one hand, using XML or YAML to describe services and their 17 17 configuration is very powerful and flexible: 18 18 … … 81 81 configuration variables, and still be very fast. 82 82 83 How can you have the best of both world ? That's quite simply. The Symfony83 How can you have the best of both worlds? That's quite simple. The Symfony 84 84 Dependency Injection component provides yet another built-in dumper: a **PHP 85 85 dumper**. This dumper can convert any service container to plain PHP code. … … 87 87 in the first place. 88 88 89 Let's use againour `Zend_Mail` example and for brevity's sake, let's use the89 Let's again use our `Zend_Mail` example and for brevity's sake, let's use the 90 90 XML definition file created in the previous chapter: 91 91 … … 157 157 >**NOTE** 158 158 >The generated code does not use the shortcut notation to access 159 >parameters and services to be as fast as possible.159 >parameters and services in order to be as fast as possible. 160 160 161 161 By using the `sfServiceContainerDumperPhp` dumper, you can have the best of 162 both world : the flexibility of the XML or YAML format to describe and162 both worlds: the flexibility of the XML or YAML format to describe and 163 163 configure your services, and the speed of an optimized and auto-generated PHP 164 164 file. … … 246 246 > * `node.missing`: The default options for missing services 247 247 248 Here is the graph for an hypothetic CMS using the Symfony 2 newTemplating248 Here is the graph for an hypothetical CMS using the new Symfony 2 Templating 249 249 Framework: 250 250 components/dependency_injection/trunk/doc/A-XML-Format.markdown
r19700 r19714 11 11 file before being parsed by the component. 12 12 13 The bare minimum and valid XML file read as follows:13 The bare minimum and valid XML file reads as follows: 14 14 15 15 [xml] … … 106 106 * The `null` string is converted to the PHP `null` value 107 107 108 * String the representednumeric values are converted to PHP numeric values108 * String representing numeric values are converted to PHP numeric values 109 109 (integer, octal notation, and hexadecimal notations are supported) 110 110 … … 269 269 ------- 270 270 271 Before the XML file is parsed, the component first read the import resources271 Before the XML file is parsed, the component first reads the import resources 272 272 defined under the `<imports>` tag: 273 273 components/dependency_injection/trunk/doc/B-YAML-Format.markdown
r19700 r19714 7 7 ### Format 8 8 9 The YAML files cannot be validated as the XML ones. So, you need to be careful10 when writing one.9 The YAML files cannot be validated like the XML ones. So, you need to be 10 careful when writing them. 11 11 12 12 The YAML file can define three main entries: … … 24 24 ### Precedence Rules 25 25 26 When loading an YAML resource, service s definitions overridesthe current26 When loading an YAML resource, service definitions override the current 27 27 defined ones. 28 28 … … 148 148 ------- 149 149 150 Before the YAML file is parsed, the component first read the import resources150 Before the YAML file is parsed, the component first reads the import resources 151 151 defined under the `imports` entry: 152 152 components/dependency_injection/trunk/doc/C-INI-Format.markdown
r19700 r19714 5 5 6 6 The INI format is only able to describe parameters. You cannot define imports, 7 nor can you import other resource from an INI file.7 nor can you import other resources from an INI file. 8 8 9 9 As for the XML and YAML format, the INI format supports placeholders. … … 20 20 21 21 The file can only define simple key/value pairs. The same parsing rules as the 22 one for the PHP built-in `parse_ini_file()` function applies.22 ones for the PHP built-in `parse_ini_file()` function apply.

