Removing redundant call to DboSource::fields(), the fields come already quoted from DboSource::read()

This commit is contained in:
Jose Lorenzo Rodriguez 2011-07-17 17:42:47 -04:30
parent ad28228495
commit b603232aee
2 changed files with 2 additions and 2 deletions

View file

@ -1460,7 +1460,7 @@ class DboSource extends DataSource {
$queryData['fields'] = $this->fields($model, $modelAlias); $queryData['fields'] = $this->fields($model, $modelAlias);
} elseif (!empty($model->hasMany) && $model->recursive > -1) { } elseif (!empty($model->hasMany) && $model->recursive > -1) {
$assocFields = $this->fields($model, $modelAlias, array("{$modelAlias}.{$model->primaryKey}")); $assocFields = $this->fields($model, $modelAlias, array("{$modelAlias}.{$model->primaryKey}"));
$passedFields = $this->fields($model, $modelAlias, $queryData['fields']); $passedFields = $queryData['fields'];
if (count($passedFields) === 1) { if (count($passedFields) === 1) {
if (strpos($passedFields[0], $assocFields[0]) === false && !preg_match('/^[a-z]+\(/i', $passedFields[0])) { if (strpos($passedFields[0], $assocFields[0]) === false && !preg_match('/^[a-z]+\(/i', $passedFields[0])) {
$queryData['fields'] = array_merge($passedFields, $assocFields); $queryData['fields'] = array_merge($passedFields, $assocFields);

View file

@ -1609,7 +1609,7 @@ class DboMysqlTest extends CakeTestCase {
$this->_buildRelatedModels($this->Model); $this->_buildRelatedModels($this->Model);
$binding = array('type' => 'hasMany', 'model' => 'TestModel6'); $binding = array('type' => 'hasMany', 'model' => 'TestModel6');
$queryData = array('fields' => array('MIN(TestModel5.test_model4_id)')); $queryData = array('fields' => array('MIN(`TestModel5`.`test_model4_id`)'));
$resultSet = null; $resultSet = null;
$null = null; $null = null;