createCommand() public method

Creates a command for execution.
public createCommand ( array $config = [] ) : Command
$config array the configuration for the Command class
return Command 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);
 }