diff --git a/composer.json b/composer.json index 589b3c16f..1f94f521f 100644 --- a/composer.json +++ b/composer.json @@ -21,11 +21,11 @@ "php": ">=7.2", "cakephp/cakephp": "^4.0", "cakephp/plugin-installer": "^1.0", - "wyrihaximus/twig-view": "dev-master" + "wyrihaximus/twig-view": "^5.0.1" }, "require-dev": { "cakephp/cakephp-codesniffer": "^4.0", - "phpunit/phpunit": "^8.0" + "phpunit/phpunit": "~8.5.0" }, "autoload": { "psr-4": { @@ -52,7 +52,5 @@ "phpstan-setup": "cp composer.json composer.backup && composer require --dev phpstan/phpstan-shim:^0.11 && mv composer.backup composer.json", "test": "phpunit", "test-coverage": "phpunit --coverage-clover=clover.xml" - }, - "prefer-stable": true, - "minimum-stability": "dev" + } } diff --git a/templates/bake/Model/table.twig b/templates/bake/Model/table.twig index 72cd36d24..38ce7a237 100644 --- a/templates/bake/Model/table.twig +++ b/templates/bake/Model/table.twig @@ -68,8 +68,10 @@ class {{ name }}Table extends Table {%- for type, assocs in associations %} {%- for assoc in assocs %} {%- set assocData = [] %} - {%- for key, val in assoc if key is not same as('alias') %} - {%- set assocData = assocData|merge({(key): val}) %} + {%- for key, val in assoc %} + {%- if key is not same as('alias') %} + {%- set assocData = assocData|merge({(key): val}) %} + {%- endif %} {%- endfor %} $this->{{ type }}('{{ assoc.alias }}', [{{ Bake.stringifyList(assocData, {'indent': 3})|raw }}]); {{- "\n" }} diff --git a/templates/bake/Template/index.twig b/templates/bake/Template/index.twig index e6fe0fee8..3829e27df 100644 --- a/templates/bake/Template/index.twig +++ b/templates/bake/Template/index.twig @@ -40,9 +40,11 @@ {% for field in fields %} {% set isKey = false %} {% if associations.BelongsTo %} -{% for alias, details in associations.BelongsTo if field == details.foreignKey %} +{% for alias, details in associations.BelongsTo %} +{% if field == details.foreignKey %} {% set isKey = true %}