When creating a many-to-many relationship, Eloquent allows you to define a custom model that will be used for the intermediate table. To do this, the model must extend the Pivot relation. That model is a simple wrapper over the base Model class, with a AsPivot trait.
To do this using the WP ORM library, I've extended the base AbstractModel class and added use AsPivot. However, this triggers an error:
Declaration of Illuminate\Database\Eloquent\Relations\Concerns\AsPivot::getTable() must be compatible with Dbout\WpOrm\Orm\AbstractModel::getTable(): string
Describe the bug
When creating a many-to-many relationship, Eloquent allows you to define a custom model that will be used for the intermediate table. To do this, the model must extend the
Pivot
relation. That model is a simple wrapper over the baseModel
class, with aAsPivot
trait.To do this using the WP ORM library, I've extended the base
AbstractModel
class and addeduse AsPivot
. However, this triggers an error:The Eloquent base
Model
class does not add a return type togetTable()
, so it seems that in order to fully support many-to-many relationships, you'll need to remove thestring
return type forgetTable()
](https://github.com/dimitriBouteille/wp-orm/blob/develop/src/Orm/AbstractModel.php#L36-L45)Your setup