Skip to content

Commit

Permalink
Merge pull request #14 from bakaphp/bug-many-to-many
Browse files Browse the repository at this point in the history
for some reason getrelations doesnt get you the hasmanbytomany relati…
  • Loading branch information
kaioken authored Apr 25, 2019
2 parents b25c112 + 2e98363 commit c09aad6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/IndexBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,11 @@ protected static function getRelatedParams(array &$params, string $parentModel,
{
$depth++;
$relationsData = self::$di->getModelsManager()->getRelations($model);


//for some reason getrelations doesnt get you the hasmanbytomany relationship
if (!empty($relationsDataHasManytoMany = self::$di->getModelsManager()->getHasManyToMany(new $model))) {
$relationsData = array_merge($relationsData, $relationsDataHasManytoMany);
}
foreach ($relationsData as $relation) {
$referencedModel = $relation->getReferencedModel();

Expand Down

0 comments on commit c09aad6

Please sign in to comment.