Browse Source

Add Driver::disableAutoQuoting().

ADmad 7 years ago
parent
commit
2ca0486539

+ 13 - 0
src/Database/Driver.php

@@ -363,6 +363,19 @@ abstract class Driver implements DriverInterface
     }
 
     /**
+     * Disable auto quoting of identifiers in queries.
+     *
+     * @return $this
+     */
+
+    public function disableAutoQuoting()
+    {
+        $this->_autoQuoting = false;
+
+        return $this;
+    }
+
+    /**
      * {@inheritDoc}
      */
     public function isAutoQuotingEnabled()

+ 2 - 0
src/Database/DriverInterface.php

@@ -18,6 +18,8 @@ use Cake\Database\Query;
 
 /**
  * Interface for database driver.
+ *
+ * @method $this disableAutoQuoting()
  */
 interface DriverInterface
 {

+ 1 - 1
tests/TestCase/Database/DriverTest.php

@@ -198,7 +198,7 @@ class DriverTest extends TestCase
         $this->assertSame($this->driver, $this->driver->enableAutoQuoting(true));
         $this->assertTrue($this->driver->isAutoQuotingEnabled());
 
-        $this->driver->enableAutoQuoting(false);
+        $this->driver->disableAutoQuoting();
         $this->assertFalse($this->driver->isAutoQuotingEnabled());
 
         $this->driver->enableAutoQuoting('string');