You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to have CrudView use displayField values when linking to associated entries. Right now it links to them via their IDs.
It isn't really documented, I guess because it should just work by default. For me it doesn't, and the only resource I found is #280, which at least gave me an idea of where to poke around.
Doing debug([$keys, $whitelist]); right after that says I have an array of normal model names as $keys (Pages, Posts) and an array of integers as $whitelist (0, 1). The latter has exactly as many elements as the former and starts from 0, which makes it seem someone just used array keys instead of values.
The text was updated successfully, but these errors were encountered:
Changing that to $this->associations = $this->_associations($related); hotfixes the issue for me, meaning associated entries are now linked to using their displayFields.
As I was looking through the file, I've seen other calls to $this->_associations (e.g. in beforeRender()) with whatever value passed there, first handled with array_keys. Not sure what's the logic there, so won't suggest any solution. Will keep the hotfix for now.
Hi,
I'm trying to have CrudView use
displayField
values when linking to associated entries. Right now it links to them via their IDs.It isn't really documented, I guess because it should just work by default. For me it doesn't, and the only resource I found is #280, which at least gave me an idea of where to poke around.
crud-view/src/Listener/ViewListener.php
Line 558 in 212573a
Doing
debug([$keys, $whitelist]);
right after that says I have an array of normal model names as$keys
(Pages
,Posts
) and an array of integers as$whitelist
(0
,1
). The latter has exactly as many elements as the former and starts from0
, which makes it seem someone just used array keys instead of values.The text was updated successfully, but these errors were encountered: