Skip to content

Commit c90d496

Browse files
authored
Merge pull request #48 from winzou/sf4
Update configuration for sf4
2 parents 6f5c1b5 + 75859b9 commit c90d496

2 files changed

Lines changed: 4 additions & 7 deletions

File tree

README.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,21 +102,18 @@ Let's imagine now that, after an exhaustive review, someone decides the `Article
102102

103103
The state machine is the object actually manipulating your object. By using the state machine you can test if a transition can be applied, actually apply a transition, retrieve the current state, etc. *A state machine is specific to a couple object + graph.* It means that if you want to manipulate another object, or the same object with another graph, *you need another state machine*.
104104

105-
The factory helps you to get the state machine for these couples object + graph. You give an object and a graph name to it, and it will return you the state machine for this couple. The factory is a service named `sm.factory`.
105+
The factory helps you to get the state machine for these couples object + graph. You give an object and a graph name to it, and it will return you the state machine for this couple. The factory is a service named `SM\Factory\Factory`.
106106

107107
#### Usage
108108

109109

110110
``` php
111111
112-
public function myAwesomeAction($id)
112+
public function myAwesomeAction($id, \SM\Factory\Factory $factory)
113113
{
114114
// Get your domain object
115115
$article = $this->getRepository('MyAwesomeBundle:Article')->find($id);
116116
117-
// Get the factory
118-
$factory = $this->get('sm.factory');
119-
120117
// Get the state machine for this object, and graph called "simple"
121118
$articleSM = $factory->get($article, 'simple');
122119
}

Resources/config/services.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ services:
66
autowire: true
77
autoconfigure: true
88
public: false
9-
bind:
10-
$configs: "%sm.configs%"
119

1210
# aliases for interfaces
1311
SM\Factory\FactoryInterface:
@@ -20,6 +18,8 @@ services:
2018
public: true
2119
SM\Extension\Twig\SMExtension:
2220
SM\Factory\Factory:
21+
arguments:
22+
$configs: "%sm.configs%"
2323

2424
# services from the bundle itself
2525
winzou\Bundle\StateMachineBundle\Callback\ContainerAwareCallbackFactory:

0 commit comments

Comments
 (0)