Skip to content
Permalink
Browse files

Removing & pass by ref operators as they aren't needed any more.

Fixing a bunch of E_STRICT errors.
  • Loading branch information...
markstory committed Dec 4, 2010
1 parent 64d1f79 commit 18fb12c95c41c130af2362c2a22e726c7b7a3185
@@ -286,7 +286,7 @@ public function describe($model) {
*
* @return boolean Returns true if a transaction is not in progress
*/
public function begin(&$model) {
public function begin() {
return !$this->_transactionStarted;
}
@@ -295,7 +295,7 @@ public function begin(&$model) {
*
* @return boolean Returns true if a transaction is in progress
*/
public function commit(&$model) {
public function commit() {
return $this->_transactionStarted;
}
@@ -304,7 +304,7 @@ public function commit(&$model) {
*
* @return boolean Returns true if a transaction is in progress
*/
public function rollback(&$model) {
public function rollback() {
return $this->_transactionStarted;
}
@@ -328,7 +328,7 @@ public function column($real) {
* @param array $values An Array of values to save.
* @return boolean success
*/
public function create(&$model, $fields = null, $values = null) {
public function create($model, $fields = null, $values = null) {
return false;
}
@@ -341,7 +341,7 @@ public function create(&$model, $fields = null, $values = null) {
* @param array $queryData An array of query data used to find the data you want
* @return mixed
*/
public function read(&$model, $queryData = array()) {
public function read($model, $queryData = array()) {
return false;
}
@@ -355,7 +355,7 @@ public function read(&$model, $queryData = array()) {
* @param array $values Array of values to be update $fields to.
* @return boolean Success
*/
public function update(&$model, $fields = null, $values = null) {
public function update($model, $fields = null, $values = null) {
return false;
}
@@ -367,7 +367,7 @@ public function update(&$model, $fields = null, $values = null) {
* @param Model $model The model class having record(s) deleted
* @param mixed $id Primary key of the model
*/
public function delete(&$model, $id = null) {
public function delete($model, $id = null) {
if ($id == null) {
$id = $model->id;
}
@@ -227,7 +227,7 @@ function listSources() {
* @param Model $model Model object to describe
* @return array Fields in table. Keys are name and type
*/
function describe(&$model) {
function describe($model) {
$cache = parent::describe($model);
if ($cache != null) {
@@ -317,7 +317,7 @@ function value($data, $column = null, $safe = false) {
* @param mixed $fields
* @return array
*/
function fields(&$model, $alias = null, $fields = array(), $quote = true) {
function fields($model, $alias = null, $fields = array(), $quote = true) {
if (empty($alias)) {
$alias = $model->alias;
}
@@ -383,7 +383,7 @@ function fields(&$model, $alias = null, $fields = array(), $quote = true) {
* @param mixed $conditions
* @return array
*/
function create(&$model, $fields = null, $values = null) {
function create($model, $fields = null, $values = null) {
if (!empty($values)) {
$fields = array_combine($fields, $values);
}
@@ -413,7 +413,7 @@ function create(&$model, $fields = null, $values = null) {
* @param mixed $conditions
* @return array
*/
function update(&$model, $fields = array(), $values = null, $conditions = null) {
function update($model, $fields = array(), $values = null, $conditions = null) {
if (!empty($values)) {
$fields = array_combine($fields, $values);
}
@@ -667,7 +667,7 @@ function __mapFields($sql) {
* @param boolean $cache Enables returning/storing cached query results
* @return array Array of resultset rows, or false if no rows matched
*/
function read(&$model, $queryData = array(), $recursive = null) {
function read($model, $queryData = array(), $recursive = null) {
$results = parent::read($model, $queryData, $recursive);
$this->__fieldMappings = array();
return $results;
@@ -329,7 +329,7 @@ function describe($model) {
* @param mixed $conditions
* @return array
*/
function update(&$model, $fields = array(), $values = null, $conditions = null) {
function update($model, $fields = array(), $values = null, $conditions = null) {
if (!$this->_useAlias) {
return parent::update($model, $fields, $values, $conditions);
}
@@ -371,7 +371,7 @@ function update(&$model, $fields = array(), $values = null, $conditions = null)
* @param mixed $conditions
* @return boolean Success
*/
function delete(&$model, $conditions = null) {
function delete($model, $conditions = null) {
if (!$this->_useAlias) {
return parent::delete($model, $conditions);
}
@@ -478,7 +478,7 @@ public function listSources() {
* @param object instance of a model to inspect
* @return array Fields in table. Keys are name and type
*/
public function describe(&$model) {
public function describe($model) {
$table = $this->fullTableName($model, false);
if (!empty($model->sequence)) {
@@ -974,7 +974,7 @@ function renderStatement($type, $data) {
* @param integer $recursive Number of levels of association
* @param array $stack
*/
function queryAssociation(&$model, &$linkModel, $type, $association, $assocData, &$queryData, $external = false, &$resultSet, $recursive, $stack) {
function queryAssociation($model, &$linkModel, $type, $association, $assocData, &$queryData, $external = false, &$resultSet, $recursive, $stack) {
if ($query = $this->generateAssociationQuery($model, $linkModel, $type, $association, $assocData, $queryData, $external, $resultSet)) {
if (!isset($resultSet) || !is_array($resultSet)) {
if (Configure::read('debug') > 0) {
@@ -185,7 +185,7 @@ function listSources() {
* @param string $tableName Name of database table to inspect
* @return array Fields in table. Keys are name and type
*/
function &describe(&$model) {
function describe($model) {
$fields = parent::describe($model);
$table = $this->fullTableName($model, false);
$this->_sequenceMap[$table] = array();
@@ -332,7 +332,7 @@ function name($data) {
* @param mixed $fields
* @return array
*/
function fields(&$model, $alias = null, $fields = array(), $quote = true) {
function fields($model, $alias = null, $fields = array(), $quote = true) {
if (empty($alias)) {
$alias = $model->alias;
}
@@ -166,7 +166,7 @@ function listSources() {
* @return array Fields in table. Keys are name and type
* @access public
*/
function describe(&$model) {
function describe($model) {
$cache = parent::describe($model);
if ($cache != null) {
return $cache;
@@ -208,7 +208,7 @@ function describe(&$model) {
* @return array
* @access public
*/
function update(&$model, $fields = array(), $values = null, $conditions = null) {
function update($model, $fields = array(), $values = null, $conditions = null) {
if (empty($values) && !empty($fields)) {
foreach ($fields as $field => $value) {
if (strpos($field, $model->alias . '.') !== false) {
@@ -458,7 +458,7 @@ function buildIndex($indexes, $table = null) {
* @return array Fields in table. Keys are column and unique
* @access public
*/
function index(&$model) {
function index($model) {
$index = array();
$table = $this->fullTableName($model);
if ($table) {
@@ -854,7 +854,7 @@ public function fullTableName($model, $quote = true) {
* be used to generate values.
* @return boolean Success
*/
public function create(&$model, $fields = null, $values = null) {
public function create($model, $fields = null, $values = null) {
$id = null;
if ($fields == null) {
@@ -902,7 +902,7 @@ public function create(&$model, $fields = null, $values = null) {
* @param integer $recursive Number of levels of association
* @return mixed boolean false on error/failure. An array of results on success.
*/
public function read(&$model, $queryData = array(), $recursive = null) {
public function read($model, $queryData = array(), $recursive = null) {
$queryData = $this->__scrubQueryData($queryData);
$null = null;
@@ -1046,7 +1046,7 @@ function __filterResults(&$results, &$model, $filtered = array()) {
* @param integer $recursive Number of levels of association
* @param array $stack
*/
public function queryAssociation(&$model, &$linkModel, $type, $association, $assocData, &$queryData, $external = false, &$resultSet, $recursive, $stack) {
public function queryAssociation($model, &$linkModel, $type, $association, $assocData, &$queryData, $external = false, &$resultSet, $recursive, $stack) {
if ($query = $this->generateAssociationQuery($model, $linkModel, $type, $association, $assocData, $queryData, $external, $resultSet)) {
if (!isset($resultSet) || !is_array($resultSet)) {
if (Configure::read('debug') > 0) {
@@ -1342,7 +1342,7 @@ function __mergeAssociation(&$data, $merge, $association, $type, $selfJoin = fal
* @param array $resultSet
* @return mixed
*/
public function generateAssociationQuery(&$model, &$linkModel, $type, $association = null, $assocData = array(), &$queryData, $external = false, &$resultSet) {
public function generateAssociationQuery($model, &$linkModel, $type, $association = null, $assocData = array(), &$queryData, $external = false, &$resultSet) {
$queryData = $this->__scrubQueryData($queryData);
$assocData = $this->__scrubQueryData($assocData);
@@ -1575,7 +1575,7 @@ public function buildJoinStatement($join) {
* @access public
* @see DboSource::renderStatement()
*/
public function buildStatement($query, &$model) {
public function buildStatement($query, $model) {
$query = array_merge(array('offset' => null, 'joins' => array()), $query);
if (!empty($query['joins'])) {
$count = count($query['joins']);
@@ -1694,7 +1694,7 @@ function __mergeConditions($query, $assoc) {
* @param mixed $conditions
* @return boolean Success
*/
public function update(&$model, $fields = array(), $values = null, $conditions = null) {
public function update($model, $fields = array(), $values = null, $conditions = null) {
if ($values == null) {
$combined = $fields;
} else {
@@ -1728,7 +1728,7 @@ public function update(&$model, $fields = array(), $values = null, $conditions =
* @param boolean $alias Include the model alias in the field name
* @return array Fields and values, quoted and preparted
*/
protected function _prepareUpdateFields(&$model, $fields, $quoteValues = true, $alias = false) {
protected function _prepareUpdateFields($model, $fields, $quoteValues = true, $alias = false) {
$quotedAlias = $this->startQuote . $model->alias . $this->endQuote;
$updates = array();
@@ -1771,7 +1771,7 @@ protected function _prepareUpdateFields(&$model, $fields, $quoteValues = true, $
* @param mixed $conditions
* @return boolean Success
*/
public function delete(&$model, $conditions = null) {
public function delete($model, $conditions = null) {
$alias = $joins = null;
$table = $this->fullTableName($model);
$conditions = $this->_matchRecords($model, $conditions);
@@ -1795,7 +1795,7 @@ public function delete(&$model, $conditions = null) {
* @param mixed $conditions
* @return array List of record IDs
*/
protected function _matchRecords(&$model, $conditions = null) {
protected function _matchRecords($model, $conditions = null) {
if ($conditions === true) {
$conditions = $this->conditions(true);
} elseif ($conditions === null) {
@@ -1871,7 +1871,7 @@ protected function _getJoins($model) {
* @param array $params Function parameters (any values must be quoted manually)
* @return string An SQL calculation function
*/
public function calculate(&$model, $func, $params = array()) {
public function calculate($model, $func, $params = array()) {
$params = (array)$params;
switch (strtolower($func)) {
@@ -1990,7 +1990,7 @@ function lastInsertId($source = null) {
* @see DboSource::update()
* @see DboSource::conditions()
*/
public function defaultConditions(&$model, $conditions, $useAlias = true) {
public function defaultConditions($model, $conditions, $useAlias = true) {
if (!empty($conditions)) {
return $conditions;
}
@@ -2049,7 +2049,7 @@ public function __scrubQueryData($data) {
* @param mixed $fields virtual fields to be used on query
* @return array
*/
protected function _constructVirtualFields(&$model, $alias, $fields) {
protected function _constructVirtualFields($model, $alias, $fields) {
$virtual = array();
foreach ($fields as $field) {
$virtualField = $this->name($alias . $this->virtualFieldSeparator . $field);
@@ -2068,7 +2068,7 @@ protected function _constructVirtualFields(&$model, $alias, $fields) {
* @param boolean $quote If false, returns fields array unquoted
* @return array
*/
public function fields(&$model, $alias = null, $fields = array(), $quote = true) {
public function fields($model, $alias = null, $fields = array(), $quote = true) {
if (empty($alias)) {
$alias = $model->alias;
}
@@ -2361,7 +2361,7 @@ public function conditionKeysToString($conditions, $quoteValues = true, $model =
* @return string
* @access private
*/
function __parseKey(&$model, $key, $value) {
function __parseKey($model, $key, $value) {
$operatorMatch = '/^((' . implode(')|(', $this->__sqlOps);
$operatorMatch .= '\\x20)|<[>=]?(?![^>]+>)\\x20?|[>=!]{1,3}(?!<)\\x20?)/is';
$bound = (strpos($key, '?') !== false || (is_array($value) && strpos($key, ':') !== false));
@@ -2612,7 +2612,7 @@ public function close() {
* @param string $sql SQL WHERE clause (condition only, not the "WHERE" part)
* @return boolean True if the table has a matching record, else false
*/
public function hasAny(&$Model, $sql) {
public function hasAny($Model, $sql) {
$sql = $this->conditions($sql);
$table = $this->fullTableName($Model);
$alias = $this->alias . $this->name($Model->alias);
@@ -2601,6 +2601,7 @@ public function testComplexSortExpression() {
* @return void
*/
function testCalculations() {
$this->Model = new TestModel();
$result = $this->Dbo->calculate($this->Model, 'count');
$this->assertEqual($result, 'COUNT(*) AS `count`');

0 comments on commit 18fb12c

Please sign in to comment.
You can’t perform that action at this time.