I am working on a plugin, where a model(“Race”) has a repeater (“race_control”, text => jsonable) which contains a recordfinder to select a RainLab User Model.
This works fine if I set useRelation
to false and set modelClass
to “RainLab\User\Models\User”.
But in the template I now only have the id of the related model. It would be much easier for me if I could get the related Model directly, but turning useRelation
to true
results in an error stating
"Model 'AramLoosman\Races\Models\Race' does not contain a definition for 'user_item'." on line 551 of /var/www/html/web/modules/backend/classes/Controller.php
This is a snippet of my “Race”-Model’s fields yaml:
race_control:
label: 'Race control'
type: repeater
tab: 'Race control'
form:
fields:
user_role:
label: 'Role'
type: text
user_item:
label: User
type: recordfinder
list: ~/plugins/rainlab/user/models/user/columns.yaml
recordsPerPage: 10
title: Find User
prompt: Click the Find button to find a user
nameFrom: name
descriptionFrom: email
useRelation: true
modelClass: RainLab\User\Models\User
Is there a way for me to keep the relation in a repeater?