Browse Source

Merge pull request #4339 from bcrowe/3.0-table-bake

3.0 - Remove extra newline in table bake when no associations
José Lorenzo Rodríguez 11 years ago
parent
commit
b486152c5b
1 changed files with 5 additions and 1 deletions
  1. 5 1
      src/Template/Bake/default/classes/table.ctp

+ 5 - 1
src/Template/Bake/default/classes/table.ctp

@@ -53,9 +53,13 @@ $key = array_map(function($el) { return "'$el'"; }, (array)$primaryKey);
 <?php foreach ($behaviors as $behavior => $behaviorData): ?>
 		$this->addBehavior('<?= $behavior ?>'<?= $behaviorData ? ", [" . implode(', ', $behaviorData) . ']' : '' ?>);
 <?php endforeach ?>
-
+<?php $firstAssoc = true; ?>
 <?php foreach ($associations as $type => $assocs): ?>
 <?php foreach ($assocs as $assoc): ?>
+<?php if ($firstAssoc): ?>
+<?= "\n" ?>
+<?php $firstAssoc = false; ?>
+<?php endif ?>
 		$this-><?= $type ?>('<?= $assoc['alias'] ?>', [
 <?php foreach ($assoc as $key => $val): ?>
 <?php if ($key !== 'alias'): ?>