mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-03-18 23:49:55 +00:00
1.2: bake, merging changes from 1.1
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@3823 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
b42373467f
commit
1db5de6623
1 changed files with 21 additions and 37 deletions
|
@ -1310,8 +1310,8 @@ class Bake {
|
||||||
$actions .= "\t\tif(empty(\$this->data)) {\n";
|
$actions .= "\t\tif(empty(\$this->data)) {\n";
|
||||||
|
|
||||||
foreach($modelObj->hasAndBelongsToMany as $associationName => $relation) {
|
foreach($modelObj->hasAndBelongsToMany as $associationName => $relation) {
|
||||||
if(!empty($relation['className'])) {
|
if(!empty($associationName)) {
|
||||||
$otherModelName = $this->__modelName($relation['className']);
|
$otherModelName = $this->__modelName($associationName);
|
||||||
$otherSingularName = $this->__singularName($associationName);
|
$otherSingularName = $this->__singularName($associationName);
|
||||||
$otherPluralName = $this->__pluralName($associationName);
|
$otherPluralName = $this->__pluralName($associationName);
|
||||||
$selectedOtherPluralName = 'selected' . ucfirst($otherPluralName);
|
$selectedOtherPluralName = 'selected' . ucfirst($otherPluralName);
|
||||||
|
@ -1320,15 +1320,11 @@ class Bake {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach($modelObj->belongsTo as $associationName => $relation) {
|
foreach($modelObj->belongsTo as $associationName => $relation) {
|
||||||
if(!empty($relation['className'])) {
|
if(!empty($associationName)) {
|
||||||
$otherModelName = $this->__modelName($relation['className']);
|
$otherModelName = $this->__modelName($associationName);
|
||||||
$otherSingularName = $this->__singularName($associationName);
|
$otherSingularName = $this->__singularName($associationName);
|
||||||
$otherPluralName = $this->__pluralName($associationName);
|
$otherPluralName = $this->__pluralName($associationName);
|
||||||
if($currentModelName != $otherModelName) {
|
$actions .= "\t\t\t\$this->set('{$otherPluralName}', \$this->{$currentModelName}->{$otherModelName}->generateList());\n";
|
||||||
$actions .= "\t\t\t\$this->set('{$otherPluralName}', \$this->{$currentModelName}->{$otherModelName}->generateList());\n";
|
|
||||||
} else {
|
|
||||||
$actions .= "\t\t\t\$this->set('{$otherPluralName}', \$this->{$currentModelName}->generateList());\n";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$actions .= "\t\t\t\$this->render();\n";
|
$actions .= "\t\t\t\$this->render();\n";
|
||||||
|
@ -1347,8 +1343,8 @@ class Bake {
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($modelObj->hasAndBelongsToMany as $associationName => $relation) {
|
foreach($modelObj->hasAndBelongsToMany as $associationName => $relation) {
|
||||||
if(!empty($relation['className'])) {
|
if(!empty($associationName)) {
|
||||||
$otherModelName = $this->__modelName($relation['className']);
|
$otherModelName = $this->__modelName($associationName);
|
||||||
$otherSingularName = $this->__singularName($associationName);
|
$otherSingularName = $this->__singularName($associationName);
|
||||||
$otherPluralName = $this->__pluralName($associationName);
|
$otherPluralName = $this->__pluralName($associationName);
|
||||||
$selectedOtherPluralName = 'selected' . ucfirst($otherPluralName);
|
$selectedOtherPluralName = 'selected' . ucfirst($otherPluralName);
|
||||||
|
@ -1358,15 +1354,11 @@ class Bake {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach($modelObj->belongsTo as $associationName => $relation) {
|
foreach($modelObj->belongsTo as $associationName => $relation) {
|
||||||
if(!empty($relation['className'])) {
|
if(!empty($associationName)) {
|
||||||
$otherModelName = $this->__modelName($relation['className']);
|
$otherModelName = $this->__modelName($associationName);
|
||||||
$otherSingularName = $this->__singularName($associationName);
|
$otherSingularName = $this->__singularName($associationName);
|
||||||
$otherPluralName = $this->__pluralName($associationName);
|
$otherPluralName = $this->__pluralName($associationName);
|
||||||
if($currentModelName != $otherModelName) {
|
$actions .= "\t\t\t\t\$this->set('{$otherPluralName}', \$this->{$currentModelName}->{$otherModelName}->generateList());\n";
|
||||||
$actions .= "\t\t\t\t\$this->set('{$otherPluralName}', \$this->{$currentModelName}->{$otherModelName}->generateList());\n";
|
|
||||||
} else {
|
|
||||||
$actions .= "\t\t\t\t\$this->set('{$otherPluralName}', \$this->{$currentModelName}->generateList());\n";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$actions .= "\t\t\t}\n";
|
$actions .= "\t\t\t}\n";
|
||||||
|
@ -1387,8 +1379,8 @@ class Bake {
|
||||||
$actions .= "\t\t\t\$this->data = \$this->{$currentModelName}->read(null, \$id);\n";
|
$actions .= "\t\t\t\$this->data = \$this->{$currentModelName}->read(null, \$id);\n";
|
||||||
|
|
||||||
foreach($modelObj->hasAndBelongsToMany as $associationName => $relation) {
|
foreach($modelObj->hasAndBelongsToMany as $associationName => $relation) {
|
||||||
if(!empty($relation['className'])) {
|
if(!empty($associationName)) {
|
||||||
$otherModelName = $this->__modelName($relation['className']);
|
$otherModelName = $this->__modelName($associationName);
|
||||||
$otherSingularName = $this->__singularName($associationName);
|
$otherSingularName = $this->__singularName($associationName);
|
||||||
$otherPluralName = $this->__pluralName($associationName);
|
$otherPluralName = $this->__pluralName($associationName);
|
||||||
$otherModelKey = Inflector::underscore($otherModelName);
|
$otherModelKey = Inflector::underscore($otherModelName);
|
||||||
|
@ -1400,15 +1392,11 @@ class Bake {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach($modelObj->belongsTo as $associationName => $relation) {
|
foreach($modelObj->belongsTo as $associationName => $relation) {
|
||||||
if(!empty($relation['className'])) {
|
if(!empty($associationName)) {
|
||||||
$otherModelName = $this->__modelName($relation['className']);
|
$otherModelName = $this->__modelName($associationName);
|
||||||
$otherSingularName = $this->__singularName($associationName);
|
$otherSingularName = $this->__singularName($associationName);
|
||||||
$otherPluralName = $this->__pluralName($associationName);
|
$otherPluralName = $this->__pluralName($associationName);
|
||||||
if($currentModelName != $otherModelName) {
|
$actions .= "\t\t\t\$this->set('{$otherPluralName}', \$this->{$currentModelName}->{$otherModelName}->generateList());\n";
|
||||||
$actions .= "\t\t\t\$this->set('{$otherPluralName}', \$this->{$currentModelName}->{$otherModelName}->generateList());\n";
|
|
||||||
} else {
|
|
||||||
$actions .= "\t\t\t\$this->set('{$otherPluralName}', \$this->{$currentModelName}->generateList());\n";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$actions .= "\t\t} else {\n";
|
$actions .= "\t\t} else {\n";
|
||||||
|
@ -1426,8 +1414,8 @@ class Bake {
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($modelObj->hasAndBelongsToMany as $associationName => $relation) {
|
foreach($modelObj->hasAndBelongsToMany as $associationName => $relation) {
|
||||||
if(!empty($relation['className'])) {
|
if(!empty($associationName)) {
|
||||||
$otherModelName = $this->__modelName($relation['className']);
|
$otherModelName = $this->__modelName($associationName);
|
||||||
$otherSingularName = $this->__singularName($associationName);
|
$otherSingularName = $this->__singularName($associationName);
|
||||||
$otherPluralName = $this->__pluralName($associationName);
|
$otherPluralName = $this->__pluralName($associationName);
|
||||||
$selectedOtherPluralName = 'selected' . ucfirst($otherPluralName);
|
$selectedOtherPluralName = 'selected' . ucfirst($otherPluralName);
|
||||||
|
@ -1437,15 +1425,11 @@ class Bake {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach($modelObj->belongsTo as $associationName => $relation) {
|
foreach($modelObj->belongsTo as $associationName => $relation) {
|
||||||
if(!empty($relation['className'])) {
|
if(!empty($associationName)) {
|
||||||
$otherModelName = $this->__modelName($relation['className']);
|
$otherModelName = $this->__modelName($associationName);
|
||||||
$otherSingularName = $this->__singularName($associationName);
|
$otherSingularName = $this->__singularName($associationName);
|
||||||
$otherPluralName = $this->__pluralName($associationName);
|
$otherPluralName = $this->__pluralName($associationName);
|
||||||
if($currentModelName != $otherModelName) {
|
$actions .= "\t\t\t\t\$this->set('{$otherPluralName}', \$this->{$currentModelName}->{$otherModelName}->generateList());\n";
|
||||||
$actions .= "\t\t\t\t\$this->set('{$otherPluralName}', \$this->{$currentModelName}->{$otherModelName}->generateList());\n";
|
|
||||||
} else {
|
|
||||||
$actions .= "\t\t\t\t\$this->set('{$otherPluralName}', \$this->{$currentModelName}->generateList());\n";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$actions .= "\t\t\t}\n";
|
$actions .= "\t\t\t}\n";
|
||||||
|
@ -2606,4 +2590,4 @@ class Bake {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Add table
Reference in a new issue