Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/Action/ExceptionAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ public function __construct(SerializerInterface $serializer, array $errorFormats
/**
* Converts a an exception to a JSON response.
*
* @param \Exception|FlattenException $exception
* @param Request $request
* @param FlattenException $exception
* @param Request $request
*
* @return Response
*/
public function __invoke($exception, Request $request) : Response
public function __invoke(FlattenException $exception, Request $request) : Response
{
$exceptionClass = $exception->getClass();
foreach ($this->exceptionToStatus as $class => $status) {
Expand Down
11 changes: 4 additions & 7 deletions src/Bridge/Doctrine/Orm/Filter/AbstractFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,11 +192,6 @@ protected function extractProperties(Request $request) : array
protected function addJoinsForNestedProperty(string $property, string $rootAlias, QueryBuilder $queryBuilder) : array
{
$propertyParts = $this->splitPropertyParts($property);

if (0 === count($propertyParts['associations'])) {
throw new InvalidArgumentException(sprintf('Cannot add joins for property "%s" - property is not nested.', $property));
}

$parentAlias = $rootAlias;

foreach ($propertyParts['associations'] as $association) {
Expand All @@ -205,8 +200,10 @@ protected function addJoinsForNestedProperty(string $property, string $rootAlias
$parentAlias = $alias;
}

$field = $propertyParts['field'];
if (!isset($alias)) {
throw new InvalidArgumentException(sprintf('Cannot add joins for property "%s" - property is not nested.', $property));
}

return [$alias, $field];
return [$alias, $propertyParts['field']];
}
}
4 changes: 2 additions & 2 deletions src/Hal/Serializer/ItemNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function supportsNormalization($data, $format = null)
*/
public function normalize($object, $format = null, array $context = [])
{
$context['cache_key'] = $this->getCacheKey($format, $context);
$context['cache_key'] = $this->getHalCacheKey($format, $context);

$rawData = parent::normalize($object, $format, $context);
if (!is_array($rawData)) {
Expand Down Expand Up @@ -217,7 +217,7 @@ private function getRelationIri($rel) : string
*
* @return bool|string
*/
private function getCacheKey(string $format = null, array $context)
private function getHalCacheKey(string $format = null, array $context)
{
try {
return md5($format.serialize($context));
Expand Down