-
Notifications
You must be signed in to change notification settings - Fork 0
BelongsTo field type
Jelle Spekken edited this page Jun 9, 2014
·
2 revisions
The belongsTo
field type is used to display a belongsTo relationship. This field can be used on the list, form and filter views.
$mapper->belongsTo('relation-name')
->display('related-field-name') // The field name to display at the other end of the relationship
->label('My great label'); // (optional) This will override the standard field label
The first argument is the belongsTo relationship given in your model.
$mapper->display('product');
public function product()
{
return $this->belongsTo('Product');
}
This field always needs the display('related-field-name') method attached to it to figure out which field to display.