[solved] Wrong type hinting property name on polymorphic association (Laravel)

0 votes
asked Jan 31, 2023 in Solved by upsite (140 points)
recategorized Feb 9, 2023 by ludek.vodicka

When exporting the models of a polymorphic association the property name is wrong. The skipper internal EntityAlias is correct

abstract class AbstractCompany extends Model
//the relation
public function documents()
{
return $this->morphMany('\App\Models\Document', 'documentable', 'documentabletype', 'documentableid');
}

//the wrong type hint
* @property \Illuminate\Database\Eloquent\Collection $company

//the right type hint should be
* @property \Illuminate\Database\Eloquent\Collection $documents

commented Jan 31, 2023 by ludek.vodicka Skipper developer (140,450 points)

Send me please a demo project where we can simulate this issue to [email protected]
Thank you

1 Answer

0 votes
answered Feb 9, 2023 by ludek.vodicka Skipper developer (140,450 points)
...