Creates a command for execution.
public createCommand ( array $config = [] ) : |
||
$config | array | the configuration for the Command class |
return | the DB command |
/** * Insert or Update a document into the index. */ public function InsertUpdate() { // Remove all new lines etc. from the json to make it valid $this->query = str_replace(array('\\n', '\\r'), '', $this->query); $connection = new Connection(); $command = $connection->createCommand(); $command->insert('api-builder', 'api', $this->query, $this->api->id); }
/** * Delete a document from the index. */ public function Delete() { $connection = new Connection(); $command = $connection->createCommand(); $command->delete('api-builder', 'api', $this->id); }