Skip to content

Commit

Permalink
Add Connection::disableQueryLogging().
Browse files Browse the repository at this point in the history
  • Loading branch information
ADmad committed Nov 1, 2018
1 parent 2ca0486 commit 5fe3e0c
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
12 changes: 12 additions & 0 deletions src/Database/Connection.php
Expand Up @@ -875,6 +875,18 @@ public function enableQueryLogging($value)
return $this;
}

/**
* Disable query logging
*
* @return $this
*/
public function disableQueryLogging()
{
$this->_logQueries = false;

return $this;
}

/**
* Check if query logging is enabled.
*
Expand Down
1 change: 1 addition & 0 deletions src/Datasource/ConnectionInterface.php
Expand Up @@ -26,6 +26,7 @@
* @method \Cake\Database\StatementInterface prepare($sql)
* @method \Cake\Database\StatementInterface execute($query, $params = [], array $types = [])
* @method $this enableQueryLogging($value)
* @method $this disableQueryLogging()
* @method bool isQueryLoggingEnabled()
* @method string quote($value, $type = null)
*/
Expand Down
2 changes: 1 addition & 1 deletion src/TestSuite/Fixture/FixtureManager.php
Expand Up @@ -402,7 +402,7 @@ protected function _runOperation($fixtures, $operation)

if ($logQueries && !$this->_debug) {
if ($newMethods) {
$db->enableQueryLogging(false);
$db->disableQueryLogging();
} else {
$db->logQueries(false);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase/Database/ConnectionTest.php
Expand Up @@ -965,7 +965,7 @@ public function testEnableQueryLogging()
$this->connection->enableQueryLogging(true);
$this->assertTrue($this->connection->isQueryLoggingEnabled());

$this->connection->enableQueryLogging(false);
$this->connection->disableQueryLogging();
$this->assertFalse($this->connection->isQueryLoggingEnabled());
}

Expand Down

0 comments on commit 5fe3e0c

Please sign in to comment.