I can't use dpq() with upsert
Issue #2847155 on drupal.org by adriancid.
This is because the Upsert::preExecute() method is protected.
If you use the upsert method and try to see the query with the devel function dpq() you get one error.
$query = $this->connection->upsert('forcontu_database_counter')
->fields([
'route' => $route,
'uid' => $uid,
'user_count' => 1,
'lastcount' => time(),
]);
$query->key('route');
$query->execute();
dpq($query);
Error: Call to protected method Drupal\Core\Database\Query\Upsert::preExecute() from context '' in dpq() (line 419 of /Users/adriancid/Sites/drupal82-test/modules/devel/devel.module) #0
But if you set to public the preExecute method you will see:
Error: Call to undefined method Drupal\Core\Database\Driver\mysql\Upsert::arguments() in dpq() (line 424 of /Users/adriancid/Sites/drupal82-test/modules/devel/devel.module) #0