Skip to content

Commit

Permalink
fix(doctrine): resource_class from context instead of entity class
Browse files Browse the repository at this point in the history
  • Loading branch information
KaiGrassnick committed Sep 6, 2024
1 parent ef0ee64 commit 350ecb3
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Doctrine/Common/State/PersistProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function process(mixed $data, Operation $operation, array $uriVariables =
\assert(method_exists($manager, 'getReference'));
$newData = $data;
$identifiers = array_reverse($uriVariables);
$links = $this->getLinks($class, $operation, $context);
$links = $this->getLinks($context['resource_class'] ?? $class, $operation, $context);
$reflectionProperties = $this->getReflectionProperties($data);

// TODO: the call to getReference is most likely to fail with complex identifiers
Expand Down
2 changes: 1 addition & 1 deletion src/Doctrine/Odm/State/LinksHandlerTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ private function handleLinks(Builder $aggregationBuilder, array $identifiers, ar
return;
}

$links = $this->getLinks($resourceClass, $operation, $context);
$links = $this->getLinks($context['resource_class'] ?? $resourceClass, $operation, $context);

if (!$links) {
return;
Expand Down
2 changes: 1 addition & 1 deletion src/Doctrine/Orm/State/LinksHandlerTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ private function handleLinks(QueryBuilder $queryBuilder, array $identifiers, Que
$doctrineClassMetadata = $manager->getClassMetadata($entityClass);
$alias = $queryBuilder->getRootAliases()[0];

$links = $this->getLinks($entityClass, $operation, $context);
$links = $this->getLinks($context['resource_class'] ?? $entityClass, $operation, $context);

if (!$links) {
return;
Expand Down

0 comments on commit 350ecb3

Please sign in to comment.