Fixing fixtures.

Fixing setting of primaryKey when a model HABTM association is defined

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5614 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
phpnut 2007-09-03 04:48:58 +00:00
parent b574a98306
commit 77a9e3dd22
2 changed files with 9 additions and 7 deletions

View file

@ -721,16 +721,18 @@ class Model extends Overloadable {
$this->{$joinClass}->name = $joinClass;
$this->{$joinClass}->primaryKey = $this->{$type}[$assocKey]['foreignKey'];
if(count($this->{$joinClass}->_schema->value) > 2) {
if(isset($this->{$joinClass}->_schema->value['id'])) {
$this->{$joinClass}->primaryKey = 'id';
}
}
} else {
$this->__constructLinkedModel($joinClass);
$this->{$joinClass}->name = $joinClass;
$this->{$joinClass}->primaryKey = $this->{$type}[$assocKey]['foreignKey'];
$this->{$type}[$assocKey]['joinTable'] = $this->{$joinClass}->table;
}
if(count($this->{$joinClass}->_schema->value) > 2) {
if(isset($this->{$joinClass}->_schema->value['id'])) {
$this->{$joinClass}->primaryKey = 'id';
}
}
}
}
}

View file

@ -192,7 +192,7 @@ class Tag extends CakeTestModel {
* @subpackage cake.tests.cases.libs.model
*/
class ArticlesTag extends CakeTestModel {
var $name = 'ArticleTag';
var $name = 'ArticlesTag';
}
/**
* Short description for class.
@ -201,7 +201,7 @@ class ArticlesTag extends CakeTestModel {
* @subpackage cake.tests.cases.libs.model
*/
class ArticleFeaturedsTag extends CakeTestModel {
var $name = 'ArticleFeaturedTag';
var $name = 'ArticleFeaturedsTag';
}
/**
* Short description for class.