Service/BatchRequestHandler.php
private function update($documents, $repository, $commitSize)
    {
        if (count($documents) > $commitSize && $commitSize > 1) {
            $esResponse = [];
            $i = 1;
            foreach ($documents as $document) {
                $id = $document['_id'];
                unset($document['_id']);
                $this->crud->update($repository, $id, $document);
                if ($i++ % ($commitSize - 1) == 0) {
                    $esResponse[] = $this->crud->commit($repository);
                }
            }
        } else {
            foreach ($documents as $document) {
                $id = $document['_id'];
                unset($document['_id']);
                $this->crud->update($repository, $id, $document);
            }
            $esResponse = $this->crud->commit($repository);
        }
        return json_encode($esResponse);
    }
private function update($documents, $repository, $commitSize)
    {
        if (count($documents) > $commitSize && $commitSize > 1) {
            $esResponse = [];
            $i = 1;
            foreach ($documents as $document) {
                $id = $document['_id'];
                unset($document['_id']);
                $this->crud->update($repository, $id, $document);
                if ($i++ % ($commitSize - 1) == 0) {
                    $esResponse[] = $this->crud->commit($repository);
                }
            }
        } else {
            foreach ($documents as $document) {
                $id = $document['_id'];
                unset($document['_id']);
                $this->crud->update($repository, $id, $document);
            }
            $esResponse = $this->crud->commit($repository);
        }
        return json_encode($esResponse);
    }
private function update ( $ documents , $ repository , $ commitSize ) { if ( count ( $ documents ) > $ commitSize && $ commitSize > 1 ) { $ esResponse = [ ] ; $ i = 1 ; foreach ( $ documents as $ document ) { $ id = $ document [ '_id' ] ; unset ( $ document [ '_id' ] ) ; $ this -> crud -> update ( $ repository , $ id , $ document ) ; if ( $ i ++ % ( $ commitSize - 1 ) == 0 ) { $ esResponse [ ] = $ this -> crud -> commit ( $ repository ) ; } } } else { foreach ( $ documents as $ document ) { $ id = $ document [ '_id' ] ; unset ( $ document [ '_id' ] ) ; $ this -> crud -> update ( $ repository , $ id , $ document ) ; } $ esResponse = $ this -> crud -> commit ( $ repository ) ; } return json_encode ( $ esResponse ) ; }
Handles update action

@param array      $documents
@param Repository $repository
@param integer    $commitSize

@return string
Handles update action