File tree 4 files changed +19
-2
lines changed
4 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -536,6 +536,7 @@ protected function getPersistenceNode()
536
536
->scalarNode ('update ' )->defaultTrue ()->end ()
537
537
->scalarNode ('delete ' )->defaultTrue ()->end ()
538
538
->scalarNode ('flush ' )->defaultTrue ()->end ()
539
+ ->booleanNode ('immediate ' )->defaultFalse ()->end ()
539
540
->scalarNode ('logger ' )
540
541
->defaultFalse ()
541
542
->treatNullLike ('fos_elastica.logger ' )
Original file line number Diff line number Diff line change @@ -581,7 +581,7 @@ private function getDoctrineEvents(array $typeConfig)
581
581
'insert ' => array (constant ($ eventsClass .'::postPersist ' )),
582
582
'update ' => array (constant ($ eventsClass .'::postUpdate ' )),
583
583
'delete ' => array (constant ($ eventsClass .'::preRemove ' )),
584
- 'flush ' => array (constant ($ eventsClass .'::postFlush ' )),
584
+ 'flush ' => array ($ typeConfig [ ' listener ' ][ ' immediate ' ] ? constant ( $ eventsClass . ' ::preFlush ' ) : constant ($ eventsClass .'::postFlush ' )),
585
585
);
586
586
587
587
foreach ($ eventMapping as $ event => $ doctrineEvents ) {
Original file line number Diff line number Diff line change @@ -127,7 +127,8 @@ Below is an example for the Doctrine ORM.
127
127
driver: orm
128
128
model: Acme\A pplicationBundle\E ntity\U ser
129
129
provider: ~
130
- listener: ~
130
+ listener:
131
+ immediate: ~
131
132
finder: ~
132
133
` ` `
133
134
Original file line number Diff line number Diff line change @@ -325,6 +325,21 @@ You can also choose to only listen for some of the events:
325
325
326
326
> **Propel** doesn't support this feature yet.
327
327
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
+
328
343
Logging Errors
329
344
--------------
330
345
You can’t perform that action at this time.
0 commit comments