modelGenerator: create automatillay foreign objects if needed

git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@3812 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
2017-07-18 18:36:46 +00:00
parent 583db6300e
commit 1ad689299b

View File

@@ -158,6 +158,20 @@ class modelGenerator
implode ("\", \"", $params). implode ("\", \"", $params).
"\"),\n"; "\"),\n";
$f .= " ));\n"; $f .= " ));\n";
$f .= "\n";
$f .= " // And the associated objects\n";
if ($this->namespaceName === false)
$path = "\\models\\";
elseif ($this->namespaceName !== "")
$path = "\\$this->namespaceName\\";
else
$path = "";
foreach ($schema["foreign"] as $field=>$params)
{
$f .= " \$this->foreign_$field = new $path$field ();\n";
$f .= " \$this->setForeignObj (\$this->foreign_$field);\n";
}
} }
$f .= " }\n"; $f .= " }\n";