Skip to content

Commit 48ab9e1

Browse files
Merge pull request #18686 from kamil-tekiela/fix-RelationController
Fix RelationController view
2 parents e8c3985 + a1267f9 commit 48ab9e1

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

‎src/Controllers/Table/RelationController.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121
use PhpMyAdmin\Utils\ForeignKey;
2222

2323
use function __;
24+
use function array_column;
2425
use function array_key_exists;
2526
use function array_keys;
26-
use function array_values;
2727
use function mb_strtoupper;
2828
use function md5;
2929
use function strtoupper;
@@ -247,7 +247,7 @@ public function __invoke(ServerRequest $request): void
247247
'options_array' => $options,
248248
'column_array' => $columnArray,
249249
'column_hash_array' => $columnHashArray,
250-
'save_row' => array_values($columns),
250+
'save_row' => array_column($columns, 'field'),
251251
'url_params' => $GLOBALS['urlParams'],
252252
'databases' => $this->dbi->getDatabaseList(),
253253
'dbi' => $this->dbi,

‎templates/table/relation/common_form.twig‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
<tbody>
8686
{% set saved_row_cnt = save_row|length - 1 %}
8787
{% for i in 0..saved_row_cnt %}
88-
{% set myfield = save_row[i]['Field'] %}
88+
{% set myfield = save_row[i] %}
8989
{# Use an md5 as array index to avoid having special characters in the name attribute (see bug #1746964 ) #}
9090
{% set myfield_md5 = column_hash_array[myfield] %}
9191

@@ -163,12 +163,12 @@
163163
<label class="form-label" for="displayFieldSelect">{% trans 'Choose column to display:' %}</label>
164164
<select class="form-select" name="display_field" id="displayFieldSelect">
165165
<option value="">---</option>
166-
{% for row in save_row %}
167-
<option value="{{ row['Field'] }}"
168-
{%- if display_field is defined and row['Field'] == display_field %}
166+
{% for field in save_row %}
167+
<option value="{{ field }}"
168+
{%- if display_field is defined and field == display_field %}
169169
selected="selected"
170170
{%- endif %}>
171-
{{ row['Field'] }}
171+
{{ field }}
172172
</option>
173173
{% endfor %}
174174
</select>

0 commit comments

Comments
 (0)