You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have ProjectEntity with such relation in it 'users' => $mapper->hasManyThrough($entity, 'Api\V2\Entities\UserEntity', 'Api\V2\Entities\UserProjectEntity', 'user_id', 'project_id')->active()->order(['displayname' => 'ASC']) ->order() does not affect on the result, its sorted by id of UserProjectEntity (it has simple structure id - user_id -project_id)
The text was updated successfully, but these errors were encountered:
You can fix this by editing the eagerLoadOnCollection method in vendor/vlucas/spot2/lib/Relation/HasManyThrough.php and changing this:
foreach ($collectionRelations as $relatedEntity) {
$relatedEntityPk = $relatedEntity->$relationRelatedForeignKey;
if ($relatedEntityPk == $throughForeignKey) {
$entityRelations[$throughLocalKey][] = $relatedEntity;
}
}
to this:
foreach ($collectionRelations as $idx=>$relatedEntity) {
$relatedEntityPk = $relatedEntity->$relationRelatedForeignKey;
if ($relatedEntityPk == $throughForeignKey) {
$entityRelations[$throughLocalKey][$idx] = $relatedEntity;
}
I have
ProjectEntity
with such relation in it'users' => $mapper->hasManyThrough($entity, 'Api\V2\Entities\UserEntity', 'Api\V2\Entities\UserProjectEntity', 'user_id', 'project_id')->active()->order(['displayname' => 'ASC'])
->order()
does not affect on the result, its sorted by id ofUserProjectEntity
(it has simple structureid - user_id -project_id
)The text was updated successfully, but these errors were encountered: