Skip to content

Commit

Permalink
bug #1866 Add support for objects as the value of entity associations…
Browse files Browse the repository at this point in the history
… primary keys (cezarystepkowski)

This PR was merged into the 1.16.x-dev branch.

Discussion
----------

Add support for objects as the value of entity associations primary keys

Needed to correctly display links to the associated *_TO_MANY entities.
I've done it the same way as here: javiereguiluz@d288178

Commits
-------

81d4fdd Add support for objects as the value of entity associations primary keys
  • Loading branch information
javiereguiluz committed Oct 19, 2017
2 parents 277ff2c + 81d4fdd commit 942bad5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Resources/views/default/field_association.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
{% for item in value|slice(0, easyadmin_config('show.max_results')) %}
<li>
{% if link_parameters is defined %}
{% set primary_key_value = attribute(item, link_parameters.primary_key_name) %}
{# the empty string concatenation is needed when the primary key is an object (e.g. an Uuid object) #}
{% set primary_key_value = '' ~ attribute(item, link_parameters.primary_key_name) %}
<a href="{{ path('easyadmin', link_parameters|merge({ id: primary_key_value, referer: '' })) }}">{{ item }}</a>
{% else %}
{{ item }}
Expand Down

0 comments on commit 942bad5

Please sign in to comment.