Skip to content

Commit ec80053

Browse files
committed
Revert "Removed any reference to immediate option related to listener"
This reverts commit ec27a19.
1 parent 9ca466a commit ec80053

File tree

4 files changed

+19
-2
lines changed

4 files changed

+19
-2
lines changed

DependencyInjection/Configuration.php

+1
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,7 @@ protected function getPersistenceNode()
536536
->scalarNode('update')->defaultTrue()->end()
537537
->scalarNode('delete')->defaultTrue()->end()
538538
->scalarNode('flush')->defaultTrue()->end()
539+
->booleanNode('immediate')->defaultFalse()->end()
539540
->scalarNode('logger')
540541
->defaultFalse()
541542
->treatNullLike('fos_elastica.logger')

DependencyInjection/FOSElasticaExtension.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ private function getDoctrineEvents(array $typeConfig)
581581
'insert' => array(constant($eventsClass.'::postPersist')),
582582
'update' => array(constant($eventsClass.'::postUpdate')),
583583
'delete' => array(constant($eventsClass.'::preRemove')),
584-
'flush' => array(constant($eventsClass.'::postFlush')),
584+
'flush' => array($typeConfig['listener']['immediate'] ? constant($eventsClass.'::preFlush') : constant($eventsClass.'::postFlush')),
585585
);
586586

587587
foreach ($eventMapping as $event => $doctrineEvents) {

Resources/doc/setup.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,8 @@ Below is an example for the Doctrine ORM.
127127
driver: orm
128128
model: Acme\ApplicationBundle\Entity\User
129129
provider: ~
130-
listener: ~
130+
listener:
131+
immediate: ~
131132
finder: ~
132133
```
133134

Resources/doc/types.md

+15
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,21 @@ You can also choose to only listen for some of the events:
325325

326326
> **Propel** doesn't support this feature yet.
327327

328+
Flushing Method
329+
---------------
330+
331+
FOSElasticaBundle, since 3.0.0 performs its indexing in the postFlush Doctrine event
332+
instead of prePersist and preUpdate which means that indexing will only occur when there
333+
has been a successful flush. This new default makes more sense but in the instance where
334+
you want to perform indexing before the flush is confirmed you may set the `immediate`
335+
option on a type persistence configuration to `true`.
336+
337+
```yaml
338+
persistence:
339+
listener:
340+
immediate: true
341+
```
342+
328343
Logging Errors
329344
--------------
330345

0 commit comments

Comments
 (0)