Removing unneeded code in model::__generateAssociation();

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5906 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
phpnut 2007-10-27 05:29:11 +00:00
parent 7bc90a2eb1
commit 19d99d13a0

View file

@ -1,6 +1,5 @@
<?php <?php
/* SVN FILE: $Id$ */ /* SVN FILE: $Id$ */
/** /**
* Object-relational mapper. * Object-relational mapper.
* *
@ -27,12 +26,10 @@
* @lastmodified $Date$ * @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License * @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/ */
/** /**
* Included libs * Included libs
*/ */
uses('class_registry', 'validation', 'overloadable', 'model' . DS . 'behavior', 'model' . DS . 'connection_manager', 'set'); uses('class_registry', 'validation', 'overloadable', 'model' . DS . 'behavior', 'model' . DS . 'connection_manager', 'set');
/** /**
* Object-relational mapper. * Object-relational mapper.
* *
@ -269,11 +266,10 @@ class Model extends Overloadable {
* @access protected * @access protected
*/ */
var $__associationKeys = array( var $__associationKeys = array(
'belongsTo' => array('className', 'foreignKey', 'conditions', 'fields', 'order', 'counterCache'), 'belongsTo' => array('className', 'foreignKey', 'conditions', 'fields', 'order', 'counterCache'),
'hasOne' => array('className', 'foreignKey','conditions', 'fields','order', 'dependent'), 'hasOne' => array('className', 'foreignKey','conditions', 'fields','order', 'dependent'),
'hasMany' => array('className', 'foreignKey', 'conditions', 'fields', 'order', 'limit', 'offset', 'dependent', 'exclusive', 'finderQuery', 'counterQuery'), 'hasMany' => array('className', 'foreignKey', 'conditions', 'fields', 'order', 'limit', 'offset', 'dependent', 'exclusive', 'finderQuery', 'counterQuery'),
'hasAndBelongsToMany' => array('className', 'joinTable', 'with', 'foreignKey', 'associationForeignKey', 'conditions', 'fields', 'order', 'limit', 'offset', 'unique', 'finderQuery', 'deleteQuery', 'insertQuery') 'hasAndBelongsToMany' => array('className', 'joinTable', 'with', 'foreignKey', 'associationForeignKey', 'conditions', 'fields', 'order', 'limit', 'offset', 'unique', 'finderQuery', 'deleteQuery', 'insertQuery'));
);
/** /**
* Holds provided/generated association key names and other data for all associations * Holds provided/generated association key names and other data for all associations
* *
@ -731,9 +727,9 @@ class Model extends Overloadable {
if ($key == 'foreignKey' && !isset($this->keyToTable[$this->{$type}[$assocKey][$key]])) { if ($key == 'foreignKey' && !isset($this->keyToTable[$this->{$type}[$assocKey][$key]])) {
$this->keyToTable[$this->{$type}[$assocKey][$key]][0] = $this->{$class}->table; $this->keyToTable[$this->{$type}[$assocKey][$key]][0] = $this->{$class}->table;
$this->keyToTable[$this->{$type}[$assocKey][$key]][1] = $this->{$class}->name; $this->keyToTable[$this->{$type}[$assocKey][$key]][1] = $this->{$class}->alias;
if ($this->{$class}->name != $class) { if ($this->{$class}->alias != $class) {
$this->keyToTable[$this->{$type}[$assocKey][$key]][2] = $class; $this->keyToTable[$this->{$type}[$assocKey][$key]][2] = $class;
} }
} }
@ -747,12 +743,10 @@ class Model extends Overloadable {
'table' => $this->{$type}[$assocKey]['joinTable'], 'table' => $this->{$type}[$assocKey]['joinTable'],
'ds' => $this->useDbConfig 'ds' => $this->useDbConfig
)); ));
$this->{$joinClass}->name = $joinClass;
$this->{$joinClass}->primaryKey = $this->{$type}[$assocKey]['foreignKey']; $this->{$joinClass}->primaryKey = $this->{$type}[$assocKey]['foreignKey'];
} else { } else {
$this->__constructLinkedModel($joinClass); $this->__constructLinkedModel($joinClass);
$this->{$joinClass}->name = $joinClass;
$this->{$joinClass}->primaryKey = $this->{$type}[$assocKey]['foreignKey']; $this->{$joinClass}->primaryKey = $this->{$type}[$assocKey]['foreignKey'];
$this->{$type}[$assocKey]['joinTable'] = $this->{$joinClass}->table; $this->{$type}[$assocKey]['joinTable'] = $this->{$joinClass}->table;
} }
@ -787,7 +781,7 @@ class Model extends Overloadable {
$this->_schema = null; $this->_schema = null;
} }
$this->table = $this->useTable = $tableName; $this->table = $this->useTable = $tableName;
$this->tableToModel[$this->table] = $this->name; $this->tableToModel[$this->table] = $this->alias;
$this->loadInfo(); $this->loadInfo();
} }
/** /**