Skip to content
Permalink
Browse files

minor cleanup

  • Loading branch information...
markstory committed May 9, 2009
1 parent 31a266f commit 046764146979ff3aab6dcd86d3c3b85d06688285
Showing with 3 additions and 7 deletions.
  1. +3 −7 cake/console/libs/tasks/model.php
@@ -536,12 +536,11 @@ function _findBelongsTo(&$model, $associations) {
$offset = strpos($fieldName, '_id');
if ($fieldName != $model->primaryKey && $offset !== false) {
$tmpModelName = $this->_modelNameFromKey($fieldName);
$assoc = array(
$associations['belongsTo'][] = array(
'alias' => $tmpModelName,
'className' => $tmpModelName,
'foreignKey' => $fieldName,
);
$associations['belongsTo'][] = $assoc;
}
}
return $associations;
@@ -556,7 +555,6 @@ function _findBelongsTo(&$model, $associations) {
**/
function _findHasOneAndMany(&$model, $associations) {
$foreignKey = $this->_modelKey($model->name);
var_dump($foreignKey);
foreach ($this->__tables as $otherTable) {
$tempOtherModel = $this->_getModelObject($this->_modelName($otherTable));
$modelFieldsTemp = $tempOtherModel->schema();
@@ -597,24 +595,22 @@ function _findHasAndBelongsToMany(&$model, $associations) {
if ($offset !== false) {
$offset = strlen($model->table . '_');
$habtmName = $this->_modelName(substr($otherTable, $offset));
$assoc = array(
$associations['hasAndBelongsToMany'][] = array(
'alias' => $habtmName,
'className' => $habtmName,
'foreignKey' => $foreignKey,
'associationForeignKey' => $this->_modelKey($habtmName),
'joinTable' => $otherTable
);
$associations['hasAndBelongsToMany'][] = $assoc;
} elseif ($otherOffset !== false) {
$habtmName = $this->_modelName(substr($otherTable, 0, $otherOffset));
$assoc = array(
$associations['hasAndBelongsToMany'][] = array(
'alias' => $habtmName,
'className' => $habtmName,
'foreignKey' => $foreignKey,
'associationForeignKey' => $this->_modelKey($habtmName),
'joinTable' => $otherTable
);
$associations['hasAndBelongsToMany'][] = $assoc;
}
}
return $associations;

0 comments on commit 0467641

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