Skip to content

Misleading exception when using the Relation FormWidget with an unsupported relation type #333

@RomainMazB

Description

@RomainMazB

Winter CMS Build

dev-develop

PHP Version

7.4

Database engine

No database

Plugins installed

No response

Issue description

When using the Relation formwidget with an unsupported relationship (example detailed below), the formwidget is throwing this misleading Exception:
image

Steps to replicate

Create a polymorphic One To Many relationship:

class Comment extends Model
{
    public $morphTo = [
        'commentable' => []
    ];
}

class Post extends Model
{
    public $morphMany = [
        'comments' => ['Acme\Blog\Models\Comment', 'name' => 'commentable']
    ];
}

class Product extends Model
{
    public $morphMany = [
        'comments' => ['Acme\Blog\Models\Comment', 'name' => 'commentable']
    ];
}

and then use the commentable relationship inside a relation formwidget of the Comment form.

Workaround

No response

Any further details?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    low priorityIssues that are backlogged for when things are less busy

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions