updating bake view templates

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5266 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
gwoo 2007-06-08 16:30:22 +00:00
parent 1737dba3d6
commit 95bb7e0f04
4 changed files with 10 additions and 1 deletions

View file

@ -38,7 +38,7 @@
} }
} }
foreach($hasAndBelongsToMany as $assocName => $assocData) { foreach($hasAndBelongsToMany as $assocName => $assocData) {
echo "\t\techo \$form->input('{$assocName}.{$assocName}');\n"; echo "\t\techo \$form->input('{$assocName}');\n";
} }
echo "\t?>\n"; echo "\t?>\n";
?> ?>

View file

@ -51,6 +51,9 @@ foreach(\${$pluralVar} as \${$singularVar}):
$otherModelKey = Inflector::underscore($otherModelClass); $otherModelKey = Inflector::underscore($otherModelClass);
$otherControllerName = Inflector::pluralize($otherModelClass); $otherControllerName = Inflector::pluralize($otherModelClass);
$otherControllerPath = Inflector::underscore($otherControllerName); $otherControllerPath = Inflector::underscore($otherControllerName);
if(isset($foreignKeys[$field['name']][2])) {
$otherModelClass = $foreignKeys[$field['name']][2];
}
$otherVariableName = Inflector::variable($otherModelClass); $otherVariableName = Inflector::variable($otherModelClass);
$otherModelObj =& ClassRegistry::getObject($otherModelKey); $otherModelObj =& ClassRegistry::getObject($otherModelKey);
$otherPrimaryKey = $otherModelObj->primaryKey; $otherPrimaryKey = $otherModelObj->primaryKey;

View file

@ -40,6 +40,9 @@ foreach($fields as $field) {
$otherModelKey = Inflector::underscore($otherModelClass); $otherModelKey = Inflector::underscore($otherModelClass);
$otherControllerName = Inflector::pluralize($otherModelClass); $otherControllerName = Inflector::pluralize($otherModelClass);
$otherControllerPath = Inflector::underscore($otherControllerName); $otherControllerPath = Inflector::underscore($otherControllerName);
if(isset($foreignKeys[$field['name']][2])) {
$otherModelClass = $foreignKeys[$field['name']][2];
}
$otherSingularVar = Inflector::variable($otherModelClass); $otherSingularVar = Inflector::variable($otherModelClass);
$otherModelObj =& ClassRegistry::getObject($otherModelKey); $otherModelObj =& ClassRegistry::getObject($otherModelKey);
$otherPrimaryKey = $otherModelObj->primaryKey; $otherPrimaryKey = $otherModelObj->primaryKey;

View file

@ -722,6 +722,9 @@ class Model extends Overloadable {
if ($key == 'foreignKey' && !isset($this->keyToTable[$this->{$type}[$assocKey][$key]])) { if ($key == 'foreignKey' && !isset($this->keyToTable[$this->{$type}[$assocKey][$key]])) {
$this->keyToTable[$this->{$type}[$assocKey][$key]][0] = $this->{$class}->table; $this->keyToTable[$this->{$type}[$assocKey][$key]][0] = $this->{$class}->table;
$this->keyToTable[$this->{$type}[$assocKey][$key]][1] = $this->{$class}->name; $this->keyToTable[$this->{$type}[$assocKey][$key]][1] = $this->{$class}->name;
if($this->{$class}->name != $class) {
$this->keyToTable[$this->{$type}[$assocKey][$key]][2] = $class;
}
} }
} }
if (isset($this->{$type}[$assocKey]['with'])) { if (isset($this->{$type}[$assocKey]['with'])) {