diff --git a/tools/modelGenerator.php b/tools/modelGenerator.php index 473ff69..067eb18 100755 --- a/tools/modelGenerator.php +++ b/tools/modelGenerator.php @@ -169,8 +169,9 @@ class modelGenerator $path = ""; foreach ($schema["foreign"] as $field=>$params) { - $f .= " \$this->foreign_$field = new $path$field ();\n"; - $f .= " \$this->setForeignObj (\$this->foreign_$field);\n"; + $objName = $params[0]; + $f .= " \$this->foreign_$objName = new $path$objName ();\n"; + $f .= " \$this->setForeignObj (\$this->foreign_$objName);\n"; } }