class SyncMySql

Class to Sync MySQL Database

Methods

void
__construct()

Constructor

void
setConnection( $con)

Set Database Connection.

void
setIndex(string $index)

Set Index to Use in Elasticsearch.

void
setType(string $type)

Set Type to use in Elasticsearch

void
setIdColumn(string $column)

Set Id column which will be set as ID in Elasticsearch index

void
setSqlQuery(string $sqlQuery)

Set sqlQuery to get data from database

insertAllData($con, $tableName = null)

Sync All data of MySQL in Elasticsearch.

insertNode($con, $insertId, $tableName = null)

Insert single data in Elasticsearch.

updateNode($con, $insertId, $tableName = null)

Update single data in Elasticsearch.

deleteNode(int $id)

Delete single data from Elasticsearch.

validate(array $data = null)

Validation of $data.

Details

at line 29
void __construct()

Constructor

Return Value

void

at line 41
void setConnection( $con)

Set Database Connection.

Parameters

$con

Return Value

void

at line 51
void setIndex(string $index)

Set Index to Use in Elasticsearch.

Parameters

string $index

Return Value

void

at line 62
void setType(string $type)

Set Type to use in Elasticsearch

Parameters

string $type

Return Value

void

at line 73
void setIdColumn(string $column)

Set Id column which will be set as ID in Elasticsearch index

Parameters

string $column

Return Value

void

at line 84
void setSqlQuery(string $sqlQuery)

Set sqlQuery to get data from database

Parameters

string $sqlQuery Select query for database

Return Value

void

at line 96
ElasticSearchClient insertAllData($con, $tableName = null)

Sync All data of MySQL in Elasticsearch.

Parameters

$con
$tableName

Return Value

ElasticSearchClient

at line 133
ElasticSearchClient insertNode($con, $insertId, $tableName = null)

Insert single data in Elasticsearch.

Parameters

$con
$insertId
$tableName

Return Value

ElasticSearchClient

at line 160
ElasticSearchClient updateNode($con, $insertId, $tableName = null)

Update single data in Elasticsearch.

Parameters

$con
$insertId
$tableName

Return Value

ElasticSearchClient

at line 189
ElasticSearchClient deleteNode(int $id)

Delete single data from Elasticsearch.

Parameters

int $id

Return Value

ElasticSearchClient

at line 208
protected ElasticSearchClient validate(array $data = null)

Validation of $data.

Parameters

array $data

Return Value

ElasticSearchClient