Skip to content
This repository has been archived by the owner on Mar 9, 2020. It is now read-only.

Commit

Permalink
Merge pull request #10 from TomHAnderson/hotfix/dynamic-inverse
Browse files Browse the repository at this point in the history
Added inversedBy to dynamic ManyToOne mappings
  • Loading branch information
TomHAnderson committed Apr 24, 2015
2 parents 852f954 + c17916f commit 656f788
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/EventListener/DynamicMappingSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,35 @@ public function loadClassMetadata(LoadClassMetadataEventArgs $eventArgs)
break;

case $this->config['client_entity']['entity']:
$metadata->mapManyToOne(array(
'targetEntity' => $this->config['user_entity']['entity'],
'fieldName' => $this->config['user_entity']['field'],
'inversedBy' => $this->config['client_entity']['field'],
));
break;
case $this->config['access_token_entity']['entity']:
$metadata->mapManyToOne(array(
'targetEntity' => $this->config['user_entity']['entity'],
'fieldName' => $this->config['user_entity']['field'],
'inversedBy' => $this->config['access_token_entity']['field'],
));
break;
case $this->config['authorization_code_entity']['entity']:
$metadata->mapManyToOne(array(
'targetEntity' => $this->config['user_entity']['entity'],
'fieldName' => $this->config['user_entity']['field'],
'inversedBy' => $this->config['authorization_code_entity']['field'],
));
break;
case $this->config['refresh_token_entity']['entity']:
$metadata->mapManyToOne(array(
'targetEntity' => $this->config['user_entity']['entity'],
'fieldName' => $this->config['user_entity']['field'],
'inversedBy' => $this->config['refresh_token_entity']['field'],
));
break;
default:
break;
}
}
}

0 comments on commit 656f788

Please sign in to comment.