Removed the isInterfaceSupported method. It not make sense in PHP5.

This commit is contained in:
Juan Basso 2011-02-24 22:51:43 -03:00
parent 05fc10e717
commit a091302c92
5 changed files with 4 additions and 24 deletions

View file

@ -276,20 +276,6 @@ class DataSource extends Object {
return true;
}
/**
* Returns true if the DataSource supports the given interface (method)
*
* @param string $interface The name of the interface (method)
* @return boolean True on success
*/
public function isInterfaceSupported($interface) {
static $methods = false;
if ($methods === false) {
$methods = get_class_methods($this);
}
return in_array($interface, $methods);
}
/**
* Sets the configuration for the DataSource.
* Merges the $config information with the _baseConfig and the existing $config property.

View file

@ -3065,7 +3065,7 @@ class DboSource extends DataSource {
*/
public function readTableParameters($name) {
$parameters = array();
if ($this->isInterfaceSupported('listDetailedSources')) {
if (method_exists($this, 'listDetailedSources')) {
$currentTableDetails = $this->listDetailedSources($name);
foreach ($this->tableParameters as $paramName => $parameter) {
if (!empty($parameter['column']) && !empty($currentTableDetails[$parameter['column']])) {

View file

@ -798,7 +798,7 @@ class Model extends Object {
$db = ConnectionManager::getDataSource($this->useDbConfig);
$db->cacheSources = ($this->cacheSources && $db->cacheSources);
if ($db->isInterfaceSupported('listSources')) {
if (method_exists($db, 'listSources')) {
$sources = $db->listSources();
if (is_array($sources) && !in_array(strtolower($this->tablePrefix . $tableName), array_map('strtolower', $sources))) {
throw new MissingTableException(array(
@ -981,7 +981,7 @@ class Model extends Object {
if (!is_array($this->_schema) || $field === true) {
$db = $this->getDataSource();
$db->cacheSources = ($this->cacheSources && $db->cacheSources);
if ($db->isInterfaceSupported('describe') && $this->useTable !== false) {
if (method_exists($db, 'describe') && $this->useTable !== false) {
$this->_schema = $db->describe($this, $field);
} elseif ($this->useTable === false) {
$this->_schema = array();

View file

@ -26,7 +26,7 @@ if ($noLogs):
$logs = array();
foreach ($sources as $source):
$db =& ConnectionManager::getDataSource($source);
if (!$db->isInterfaceSupported('getLog')):
if (!method_exists($db, 'getLog')):
continue;
endif;
$logs[$source] = $db->getLog();

View file

@ -2987,10 +2987,6 @@ class ModelWriteTest extends BaseModelTest {
$db = ConnectionManager::create('mock_transaction', array(
'datasource' => 'MockTransactionDbo',
));
$db->expects($this->at(2))
->method('isInterfaceSupported')
->with('describe')
->will($this->returnValue(true));
$db->expects($this->once())
->method('describe')
@ -3026,8 +3022,6 @@ class ModelWriteTest extends BaseModelTest {
$db->columns = $testDb->columns;
$db->expects($this->once())->method('rollback');
$db->expects($this->any())->method('isInterfaceSupported')
->will($this->returnValue(true));
$db->expects($this->any())->method('describe')
->will($this->returnValue(array(
'id' => array('type' => 'integer'),