Use bulk insert. Still working on bulk update/delete which is not yet suppored in Elastica.
This commit is contained in:
parent
3bd9155f46
commit
7481376835
|
@ -214,9 +214,10 @@ class Listener implements EventSubscriber
|
|||
*/
|
||||
private function persistScheduled()
|
||||
{
|
||||
foreach ($this->scheduledForInsertion as $entity) {
|
||||
$this->objectPersister->insertOne($entity);
|
||||
if (count($this->scheduledForInsertion)) {
|
||||
$this->objectPersister->insertMany($this->scheduledForInsertion);
|
||||
}
|
||||
|
||||
foreach ($this->scheduledForUpdate as $entity) {
|
||||
$this->objectPersister->replaceOne($entity);
|
||||
}
|
||||
|
|
|
@ -22,8 +22,8 @@ abstract class ListenerTest extends \PHPUnit_Framework_TestCase
|
|||
$this->assertEquals($entity, current($listener->scheduledForInsertion));
|
||||
|
||||
$persister->expects($this->once())
|
||||
->method('insertOne')
|
||||
->with($entity);
|
||||
->method('insertMany')
|
||||
->with($listener->scheduledForInsertion);
|
||||
|
||||
$listener->postFlush($eventArgs);
|
||||
}
|
||||
|
@ -46,6 +46,8 @@ abstract class ListenerTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
$persister->expects($this->never())
|
||||
->method('insertOne');
|
||||
$persister->expects($this->never())
|
||||
->method('insertMany');
|
||||
|
||||
$listener->postFlush($eventArgs);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue