for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace GBProd\ElasticsearchDataProviderBundle\DataProvider;
use Elasticsearch\Client;
/**
* Abstract class for data providing
*
* @author gbprod <[email protected]>
*/
abstract class DataProvider
{
* @var Client
private $client;
* @var string
private $index;
private $type;
* Populate index
* @param Client $client
* @index string $index
* @index string $type
public function run(Client $client, $index, $type)
$this->client = $client;
$this->index = $index;
$this->type = $type;
$this->populate();
}
* Populate
* @return null
abstract public function populate();
* Index document
* @param string $id
* @param array $body
public function index($id, array $body)
$this->client->index([
'index' => $this->index,
'type' => $this->type,
'id' => $id,
'body' => $body,
]);