adonisjs / lucid

AdonisJS SQL ORM. Supports PostgreSQL, MySQL, MSSQL, Redshift, SQLite and many more
https://lucid.adonisjs.com/
MIT License
1.07k stars 193 forks source link

Trying to eagerload relationship twice by using multiple with(), different relationships #445

Closed fokoz closed 5 years ago

fokoz commented 5 years ago

Package version

6.1.3

Node.js and npm version

9.1.0 and 6.4.1

Sample Code (to reproduce the issue)

Getting this error: E_CANNOT_OVERRIDE_RELATION: Trying to eagerload headChef relationship twice

When I try to fetch multiple with: await Kitchen.query().with('headChef').with('chef').fetch()

both headChef() and chef() belongs to the same model App/Models/Chef but using different id (head_chef_id, chef_id)

fokoz commented 5 years ago

Turn out it is a problem with the plugin https://github.com/enniel/adonis-lucid-polymorphic/issues/9