DikkiX
(DikkiX)
1
Hi im trying to display my “klantennaam” in my “Overzicht” Form but it keeps giving me an error that my class is not found.
I tried calling it with Mapping.
<?= $form->field($model, 'Klanten_id')->dropDownList(ArrayHelper::map(Klanten::find()->select(['klantennaam','ID'])->all(), 'ID', 'displayName'),['class' => 'form-control inline-block']); ?>
I have an “Overzicht” Model that gets my foreignkey.
public function getKlanten()
{
return $this->hasOne(Klanten::class, ['ID' => 'Klanten_id']);
}
And that workss good but i need it working for my Form.
Hopefully this is an easy fix!
DikkiX
(DikkiX)
3
How do u mean ? Like use Arrayhelper??
DikkiX
(DikkiX)
5
Still vague for me.
use statement of what??? Arrayhelper or Klanten. and where should i create the class if it doesn’t exist?
i used an YT tutorial and didn’t miss a thing.
tri
(tri - Tommy Riboe)
6
DikkiX
(DikkiX)
7
This tut is for something else its actually,
What im trying to do is showing foreign relations in _Form
So that i can chose names from foreign table instead of having to fill the id every time like in the video
tri
(tri - Tommy Riboe)
8
You probably defined Klanten i app/models, frontend/models or backend/models.
And as said before, do not post images, use plain text (click preformatted text in the editor).
DikkiX
(DikkiX)
9
Fixed it!
ill keep that in mind next time