Removing reference operators from function signatures. Fixes #1223

This commit is contained in:
mark_story 2011-03-26 00:04:25 -04:00
parent d0e574cbba
commit 893ced5c30
11 changed files with 22 additions and 24 deletions

View file

@ -308,7 +308,7 @@ class ModelTask extends BakeTask {
* @param object $model Model to have validations generated for. * @param object $model Model to have validations generated for.
* @return array $validate Array of user selected validations. * @return array $validate Array of user selected validations.
*/ */
public function doValidation(&$model) { public function doValidation($model) {
if (!is_object($model)) { if (!is_object($model)) {
return false; return false;
} }
@ -440,7 +440,7 @@ class ModelTask extends BakeTask {
* @param object $model * @param object $model
* @return array $assocaitons * @return array $assocaitons
*/ */
public function doAssociations(&$model) { public function doAssociations($model) {
if (!is_object($model)) { if (!is_object($model)) {
return false; return false;
} }
@ -491,7 +491,7 @@ class ModelTask extends BakeTask {
* @param array $associations Array of inprogress associations * @param array $associations Array of inprogress associations
* @return array $associations with belongsTo added in. * @return array $associations with belongsTo added in.
*/ */
public function findBelongsTo(&$model, $associations) { public function findBelongsTo($model, $associations) {
$fields = $model->schema(true); $fields = $model->schema(true);
foreach ($fields as $fieldName => $field) { foreach ($fields as $fieldName => $field) {
$offset = strpos($fieldName, '_id'); $offset = strpos($fieldName, '_id');
@ -520,7 +520,7 @@ class ModelTask extends BakeTask {
* @param array $associations Array of inprogress associations * @param array $associations Array of inprogress associations
* @return array $associations with hasOne and hasMany added in. * @return array $associations with hasOne and hasMany added in.
*/ */
public function findHasOneAndMany(&$model, $associations) { public function findHasOneAndMany($model, $associations) {
$foreignKey = $this->_modelKey($model->name); $foreignKey = $this->_modelKey($model->name);
foreach ($this->_tables as $otherTable) { foreach ($this->_tables as $otherTable) {
$tempOtherModel = $this->_getModelObject($this->_modelName($otherTable), $otherTable); $tempOtherModel = $this->_getModelObject($this->_modelName($otherTable), $otherTable);
@ -563,7 +563,7 @@ class ModelTask extends BakeTask {
* @param array $associations Array of inprogress associations * @param array $associations Array of inprogress associations
* @return array $associations with hasAndBelongsToMany added in. * @return array $associations with hasAndBelongsToMany added in.
*/ */
public function findHasAndBelongsToMany(&$model, $associations) { public function findHasAndBelongsToMany($model, $associations) {
$foreignKey = $this->_modelKey($model->name); $foreignKey = $this->_modelKey($model->name);
foreach ($this->_tables as $otherTable) { foreach ($this->_tables as $otherTable) {
$tempOtherModel = $this->_getModelObject($this->_modelName($otherTable), $otherTable); $tempOtherModel = $this->_getModelObject($this->_modelName($otherTable), $otherTable);
@ -603,7 +603,7 @@ class ModelTask extends BakeTask {
* @param array $associations Array of associations to be confirmed. * @param array $associations Array of associations to be confirmed.
* @return array Array of confirmed associations * @return array Array of confirmed associations
*/ */
public function confirmAssociations(&$model, $associations) { public function confirmAssociations($model, $associations) {
foreach ($associations as $type => $settings) { foreach ($associations as $type => $settings) {
if (!empty($associations[$type])) { if (!empty($associations[$type])) {
$count = count($associations[$type]); $count = count($associations[$type]);

View file

@ -289,7 +289,7 @@ class TestTask extends BakeTask {
* @param object $subject The object you want to generate fixtures for. * @param object $subject The object you want to generate fixtures for.
* @return array Array of fixtures to be included in the test. * @return array Array of fixtures to be included in the test.
*/ */
public function generateFixtureList(&$subject) { public function generateFixtureList($subject) {
$this->_fixtures = array(); $this->_fixtures = array();
if (is_a($subject, 'Model')) { if (is_a($subject, 'Model')) {
$this->_processModel($subject); $this->_processModel($subject);
@ -306,7 +306,7 @@ class TestTask extends BakeTask {
* @param Model $subject A Model class to scan for associations and pull fixtures off of. * @param Model $subject A Model class to scan for associations and pull fixtures off of.
* @return void * @return void
*/ */
protected function _processModel(&$subject) { protected function _processModel($subject) {
$this->_addFixture($subject->name); $this->_addFixture($subject->name);
$associated = $subject->getAssociated(); $associated = $subject->getAssociated();
foreach ($associated as $alias => $type) { foreach ($associated as $alias => $type) {
@ -330,7 +330,7 @@ class TestTask extends BakeTask {
* @param Controller $subject A controller to pull model names off of. * @param Controller $subject A controller to pull model names off of.
* @return void * @return void
*/ */
protected function _processController(&$subject) { protected function _processController($subject) {
$subject->constructClasses(); $subject->constructClasses();
$models = array(Inflector::classify($subject->name)); $models = array(Inflector::classify($subject->name));
if (!empty($subject->uses)) { if (!empty($subject->uses)) {

View file

@ -455,7 +455,7 @@ class ViewTask extends BakeTask {
* @return array $associations * @return array $associations
* @access private * @access private
*/ */
private function __associations(&$model) { private function __associations($model) {
$keys = array('belongsTo', 'hasOne', 'hasMany', 'hasAndBelongsToMany'); $keys = array('belongsTo', 'hasOne', 'hasMany', 'hasAndBelongsToMany');
$associations = array(); $associations = array();

View file

@ -173,7 +173,7 @@ class ClassRegistry {
* @param mixed $object Object to store * @param mixed $object Object to store
* @return boolean True if the object was written, false if $key already exists * @return boolean True if the object was written, false if $key already exists
*/ */
public static function addObject($key, &$object) { public static function addObject($key, $object) {
$_this = ClassRegistry::getInstance(); $_this = ClassRegistry::getInstance();
$key = Inflector::underscore($key); $key = Inflector::underscore($key);
if (!isset($_this->__objects[$key])) { if (!isset($_this->__objects[$key])) {

View file

@ -119,13 +119,11 @@ class ConnectionManager {
/** /**
* Gets a DataSource name from an object reference. * Gets a DataSource name from an object reference.
* *
* **Warning** this method may cause fatal errors in PHP4.
*
* @param object $source DataSource object * @param object $source DataSource object
* @return string Datasource name, or null if source is not present * @return string Datasource name, or null if source is not present
* in the ConnectionManager. * in the ConnectionManager.
*/ */
public static function getSourceName(&$source) { public static function getSourceName($source) {
$_this = ConnectionManager::getInstance(); $_this = ConnectionManager::getInstance();
foreach ($_this->_dataSources as $name => $ds) { foreach ($_this->_dataSources as $name => $ds) {
if ($ds == $source) { if ($ds == $source) {

View file

@ -1449,7 +1449,7 @@ class Model extends Object {
* @param mixed $id ID of record in this model * @param mixed $id ID of record in this model
* @access private * @access private
*/ */
function __saveMulti($joined, $id, &$db) { function __saveMulti($joined, $id, $db) {
foreach ($joined as $assoc => $data) { foreach ($joined as $assoc => $data) {
if (isset($this->hasAndBelongsToMany[$assoc])) { if (isset($this->hasAndBelongsToMany[$assoc])) {

View file

@ -263,7 +263,7 @@ class Sanitize {
* *
* @param Model $model The model containing the data to be formatted * @param Model $model The model containing the data to be formatted
*/ */
public static function formatColumns(&$model) { public static function formatColumns($model) {
foreach ($model->data as $name => $values) { foreach ($model->data as $name => $values) {
if ($name == $model->alias) { if ($name == $model->alias) {
$curModel =& $model; $curModel =& $model;

View file

@ -181,7 +181,7 @@ class Xml {
* @param string $format Either 'attribute' or 'tags'. This determines where nested keys go. * @param string $format Either 'attribute' or 'tags'. This determines where nested keys go.
* @return void * @return void
*/ */
protected static function _fromArray(&$dom, &$node, &$data, $format) { protected static function _fromArray($dom, $node, &$data, $format) {
if (empty($data) || !is_array($data)) { if (empty($data) || !is_array($data)) {
return; return;
} }

View file

@ -75,7 +75,7 @@ class DboMssqlTestDb extends DboMssql {
* @access protected * @access protected
* @return void * @return void
*/ */
function _matchRecords(&$model, $conditions = null) { function _matchRecords($model, $conditions = null) {
return $this->conditions(array('id' => array(1, 2))); return $this->conditions(array('id' => array(1, 2)));
} }

View file

@ -986,7 +986,7 @@ class DboMysqlTest extends CakeTestCase {
* @access protected * @access protected
* @return void * @return void
*/ */
function _buildRelatedModels(&$model) { function _buildRelatedModels($model) {
foreach ($model->associations() as $type) { foreach ($model->associations() as $type) {
foreach ($model->{$type} as $assoc => $assocData) { foreach ($model->{$type} as $assoc => $assocData) {
if (is_string($assocData)) { if (is_string($assocData)) {
@ -1009,7 +1009,7 @@ class DboMysqlTest extends CakeTestCase {
* @access public * @access public
* @return void * @return void
*/ */
function &_prepareAssociationQuery(&$model, &$queryData, $binding) { function &_prepareAssociationQuery($model, &$queryData, $binding) {
$type = $binding['type']; $type = $binding['type'];
$assoc = $binding['model']; $assoc = $binding['model'];
$assocData = $model->{$type}[$assoc]; $assocData = $model->{$type}[$assoc];

View file

@ -136,7 +136,7 @@ class CakeTestFixture {
* @param object $db An instance of the database object used to create the fixture table * @param object $db An instance of the database object used to create the fixture table
* @return boolean True on success, false on failure * @return boolean True on success, false on failure
*/ */
public function create(&$db) { public function create($db) {
if (!isset($this->fields) || empty($this->fields)) { if (!isset($this->fields) || empty($this->fields)) {
return false; return false;
} }
@ -153,7 +153,7 @@ class CakeTestFixture {
* @param object $db An instance of the database object used to create the fixture table * @param object $db An instance of the database object used to create the fixture table
* @return boolean True on success, false on failure * @return boolean True on success, false on failure
*/ */
public function drop(&$db) { public function drop($db) {
if (empty($this->fields)) { if (empty($this->fields)) {
return false; return false;
} }
@ -170,7 +170,7 @@ class CakeTestFixture {
* @param object $db An instance of the database into which the records will be inserted * @param object $db An instance of the database into which the records will be inserted
* @return boolean on success or if there are no records to insert, or false on failure * @return boolean on success or if there are no records to insert, or false on failure
*/ */
public function insert(&$db) { public function insert($db) {
if (!isset($this->_insert)) { if (!isset($this->_insert)) {
$values = array(); $values = array();
if (isset($this->records) && !empty($this->records)) { if (isset($this->records) && !empty($this->records)) {
@ -191,7 +191,7 @@ class CakeTestFixture {
* @param object $db A reference to a db instance * @param object $db A reference to a db instance
* @return boolean * @return boolean
*/ */
public function truncate(&$db) { public function truncate($db) {
$fullDebug = $db->fullDebug; $fullDebug = $db->fullDebug;
$db->fullDebug = false; $db->fullDebug = false;
$return = $db->truncate($this->table); $return = $db->truncate($this->table);