Skip to content

Instantly share code, notes, and snippets.

@brianium
Created March 28, 2017 19:00
Show Gist options
  • Save brianium/daaf5228fe30cb16b65d3fa79e5faa3d to your computer and use it in GitHub Desktop.
Save brianium/daaf5228fe30cb16b65d3fa79e5faa3d to your computer and use it in GitHub Desktop.
Provides the minimum interface required for Phinx's use of PDO within adapters.
<?php
/**
* Class PdoLikeObject - its like PDO, but not!
*/
class PdoLikeObject
{
/**
* Return the given value after it has been quoted by WordPress' esc_sql function
*
* @param string $value
* @return array|string
*/
public function quote($value)
{
return esc_sql($value);
}
}
@brianium
Copy link
Author

Phinx seems to pass the PDO connection around just for the purpose of quoting values. We fake the connection object out by stubbing this in as the connection property inside the WpdbAdapter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment