You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$entityManager->beginTransaction();
$order = new Order();
$order->setCode('test123456789');
$entityManager->persist($order);
$entityManager->flush();
$entityManager->rollback();
My order is not create in my database but if i check my elasticsearch, i can find this order
Now, if i go to my order list page, i have an error because Elastica cannot find this order in my database
So, how can i index my entity only if a transaction is committed and not rollbacked ? (i see nothing about that in closed or opened issues and nothing about it in any site like stackoverflow. Did i miss something ?)
Thanks for helping
The text was updated successfully, but these errors were encountered:
Hi @timmtim
I duplicate the Listener used by FOSElastica to fix it.
I create an array with entities in case of a transaction is running
I create a decorator on EntityManager to dispatch a custom event on rollback method and commit to do something on Listener (remove entities from array or push it on elastic if it is not defer etc...)
Be careful about nested transaction
I'm not very happy about my fix but I need it to avoid any error on my app
I'm waiting for an official fix :/
Package Version : v6.2.0
PHP version : 8.2.5
doctrine/dbal version : 3.6.2
Symfony version : 5.4.22
Elastica conf :
With this conf, if i run this code
My order is not create in my database but if i check my elasticsearch, i can find this order
Now, if i go to my order list page, i have an error because Elastica cannot find this order in my database
So, how can i index my entity only if a transaction is committed and not rollbacked ? (i see nothing about that in closed or opened issues and nothing about it in any site like stackoverflow. Did i miss something ?)
Thanks for helping
The text was updated successfully, but these errors were encountered: