Skip to content
This repository
Browse code

minor cleanup

  • Loading branch information...
commit 046764146979ff3aab6dcd86d3c3b85d06688285 1 parent 31a266f
Mark Story authored May 09, 2009

Showing 1 changed file with 3 additions and 7 deletions. Show diff stats Hide diff stats

  1. 10  cake/console/libs/tasks/model.php
10  cake/console/libs/tasks/model.php
@@ -536,12 +536,11 @@ function _findBelongsTo(&$model, $associations) {
536 536
 			$offset = strpos($fieldName, '_id');
537 537
 			if ($fieldName != $model->primaryKey && $offset !== false) {
538 538
 				$tmpModelName = $this->_modelNameFromKey($fieldName);
539  
-				$assoc = array(
  539
+				$associations['belongsTo'][] = array(
540 540
 					'alias' => $tmpModelName,
541 541
 					'className' => $tmpModelName,
542 542
 					'foreignKey' => $fieldName,
543 543
 				);
544  
-				$associations['belongsTo'][] = $assoc;
545 544
 			}
546 545
 		}
547 546
 		return $associations;
@@ -556,7 +555,6 @@ function _findBelongsTo(&$model, $associations) {
556 555
  **/
557 556
 	function _findHasOneAndMany(&$model, $associations) {
558 557
 		$foreignKey = $this->_modelKey($model->name);
559  
-						var_dump($foreignKey);
560 558
 		foreach ($this->__tables as $otherTable) {
561 559
 			$tempOtherModel = $this->_getModelObject($this->_modelName($otherTable));
562 560
 			$modelFieldsTemp = $tempOtherModel->schema();
@@ -597,24 +595,22 @@ function _findHasAndBelongsToMany(&$model, $associations) {
597 595
 			if ($offset !== false) {
598 596
 				$offset = strlen($model->table . '_');
599 597
 				$habtmName = $this->_modelName(substr($otherTable, $offset));
600  
-				$assoc = array(
  598
+				$associations['hasAndBelongsToMany'][] = array(
601 599
 					'alias' => $habtmName,
602 600
 					'className' => $habtmName,
603 601
 					'foreignKey' => $foreignKey,
604 602
 					'associationForeignKey' => $this->_modelKey($habtmName),
605 603
 					'joinTable' => $otherTable
606 604
 				);
607  
-				$associations['hasAndBelongsToMany'][] = $assoc;
608 605
 			} elseif ($otherOffset !== false) {
609 606
 				$habtmName = $this->_modelName(substr($otherTable, 0, $otherOffset));
610  
-				$assoc = array(
  607
+				$associations['hasAndBelongsToMany'][] = array(
611 608
 					'alias' => $habtmName,
612 609
 					'className' => $habtmName,
613 610
 					'foreignKey' => $foreignKey,
614 611
 					'associationForeignKey' => $this->_modelKey($habtmName),
615 612
 					'joinTable' => $otherTable
616 613
 				);
617  
-				$associations['hasAndBelongsToMany'][] = $assoc;
618 614
 			}
619 615
 		}
620 616
 		return $associations;

0 notes on commit 0467641

Please sign in to comment.
Something went wrong with that request. Please try again.