Skip to content

Commit

Permalink
feat: add DoctrineStorage to the documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruesa18 committed Oct 24, 2023
1 parent 9e25a75 commit 3ca9cb4
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,35 @@ public function createVehicleAction() {
}
```

## DoctrineStorage
You can configure CraueFormFlowBundle to use the DoctrineStorage instead of the SessionStorage.
If a user then starts to fill out the form, the data will always be saved to the database instead of the session.
DoctrineStorage will use an extra table (`craue_form_flow_storage`) for this purpose.
You can use this example configuration as a starting point:
```yaml
# config/packages/craue_form_flow.yaml
services:
Craue\FormFlowBundle\Storage\UserSessionStorageKeyGenerator:
arguments: [ '@security.token_storage', '@request_stack' ]
Craue\FormFlowBundle\Storage\DoctrineStorage:
arguments: [ '@doctrine.dbal.default_connection', '@Craue\FormFlowBundle\Storage\UserSessionStorageKeyGenerator' ]
myCompany.form.flow.storage.doctrine_storage:
class: 'Craue\FormFlowBundle\Storage\DataManager'
arguments: [ '@Craue\FormFlowBundle\Storage\DoctrineStorage' ]
```

```yaml
# config/services.yaml
services:
myCompany.form.flow.createVehicle:
autoconfigure: false
calls:
- [ setDataManager, [ '@myCompany.form.flow.storage.doctrine_storage'] ]
- [ setFormFactory, [ '@form.factory' ] ]
- [ setRequestStack, [ '@request_stack' ] ]
- [ setEventDispatcher, [ '@?event_dispatcher' ] ]
```

# Explanations

## How the flow works
Expand Down

0 comments on commit 3ca9cb4

Please sign in to comment.