Browse Source

Same fix for the view template

Jose Lorenzo Rodriguez 11 years ago
parent
commit
8051888e11
1 changed files with 1 additions and 1 deletions
  1. 1 1
      src/Template/Bake/default/views/view.ctp

+ 1 - 1
src/Template/Bake/default/views/view.ctp

@@ -25,7 +25,7 @@ foreach ($fields as $field) {
 			if ($field === $details['foreignKey']) {
 				$isKey = true;
 				echo "\t\t<dt><?= __('" . Inflector::humanize(Inflector::underscore($details['property'])) . "'); ?></dt>\n";
-				echo "\t\t<dd>\n\t\t\t<?= \$this->Html->link(\${$singularVar}->{$details['property']}->{$details['displayField']}, ['controller' => '{$details['controller']}', 'action' => 'view', \${$singularVar}->{$details['property']}->{$details['primaryKey'][0]}]); ?>\n\t\t\t&nbsp;\n\t\t</dd>\n";
+				echo "\t\t<dd>\n\t\t\t<?= \${$singularVar}->has('{$details['property']}') ? \$this->Html->link(\${$singularVar}->{$details['property']}->{$details['displayField']}, ['controller' => '{$details['controller']}', 'action' => 'view', \${$singularVar}->{$details['property']}->{$details['primaryKey'][0]}]) : ''; ?>\n\t\t\t&nbsp;\n\t\t</dd>\n";
 				break;
 			}
 		}