Skip to content

Commit

Permalink
relationships: fixed passing metadata to getManyHasManyParameters() [c…
Browse files Browse the repository at this point in the history
…loses #277]
  • Loading branch information
hrach committed Nov 11, 2018
1 parent d345d45 commit 5521b89
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/Mapper/Dbal/RelationshipMapperManyHasMany.php
Expand Up @@ -56,7 +56,15 @@ public function __construct(IConnection $connection, DbalMapper $mapperOne, Dbal
$this->connection = $connection;
$this->metadata = $metadata;

$parameters = $mapperOne->getManyHasManyParameters($metadata, $mapperTwo);
if ($metadata->relationship->isMain) {
$parameters = $mapperOne->getManyHasManyParameters($metadata, $mapperTwo);
} else {
assert($metadata->relationship->property !== null);
$parameters = $mapperOne->getManyHasManyParameters(
$metadata->relationship->entityMetadata->getProperty($metadata->relationship->property),
$mapperTwo
);
}
$this->joinTable = $parameters[0];

if ($metadata->relationship->isMain) {
Expand Down

0 comments on commit 5521b89

Please sign in to comment.