Skip to content

Instantly share code, notes, and snippets.

@tvlooy
Created June 13, 2014 21:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tvlooy/a6b9c58c5d1ab4076775 to your computer and use it in GitHub Desktop.
Save tvlooy/a6b9c58c5d1ab4076775 to your computer and use it in GitHub Desktop.
Example service with factory method
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<services>
<service id="foo" class="DateTime"
factory-class="DateTime"
factory-method="createFromFormat">
<argument>Ymd</argument>
<argument>20120101</argument>
</service>
</services>
</container>
-----------------------------------------
services:
foo:
class: DateTime
factory_class: DateTime
factory_method: createFromFormat
arguments:
- Ymd
- 20120101
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment