Skip to content

Commit abab585

Browse files
authored
Merge pull request #4678 from soyuka/merge-26
Merge 2.6
2 parents 20f2f55 + 0eccf87 commit abab585

35 files changed

+1264
-413
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
/.php_cs.dist export-ignore
66
/appveyor.yml export-ignore
77
/behat.yml.dist export-ignore
8+
/docs export-ignore
89
/features export-ignore
910
/phpstan.neon.dist export-ignore
1011
/phpunit.xml.dist export-ignore

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,13 @@
4747
* Mark the GraphQL subsystem as stable (#4500)
4848
* feat(test): add `Client::loginUser()`
4949

50+
## 2.6.8
51+
52+
* fix: serializing embedded non resource objects
53+
* chore(openapi): upgrade Swagger UI to version 4.1.3
54+
* chore(openapi): upgrade ReDoc to version 2.0.0-rc.59
55+
* chore(graphql): upgrade GraphiQL to version 1.5.16
56+
5057
## 2.6.7
5158

5259
* feat: compatibility with Symfony 6 (#4503, #4582, #4604, #4564)

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Alternatively, you can also work with the test application we provide:
4545
### Matching Coding Standards
4646

4747
The API Platform project follows [Symfony coding standards](https://symfony.com/doc/current/contributing/code/standards.html).
48-
But don't worry, you can fix CS issues automatically using the [PHP CS Fixer](https://cs.sensiolabs.org/) tool:
48+
But don't worry, you can fix CS issues automatically using the [PHP CS Fixer](https://cs.symfony.com) tool:
4949

5050
php-cs-fixer.phar fix
5151

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ high performance API-first projects. Extend or override everything you want.
1111

1212
[![GitHub Actions](https://github.com/api-platform/core/workflows/CI/badge.svg?branch=main)](https://github.com/api-platform/core/actions?query=workflow%3ACI+branch%3Amain)
1313
[![Codecov](https://codecov.io/gh/api-platform/core/branch/main/graph/badge.svg)](https://codecov.io/gh/api-platform/core/branch/main)
14-
[![SymfonyInsight](https://insight.symfony.com/projects/92d78899-946c-4282-89a3-ac92344f9a93/mini.svg)](https://insight.symfony.com/projects/92d78899-946c-4282-89a3-ac92344f9a93)
1514
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/api-platform/core/badges/quality-score.png?b=main)](https://scrutinizer-ci.com/g/api-platform/core/?branch=main)
1615

1716
## Documentation

src/Doctrine/Orm/Extension/FilterEagerLoadingExtension.php

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,14 +167,14 @@ private function getQueryBuilderWithNewAliases(QueryBuilder $queryBuilder, Query
167167
// Change join aliases
168168
foreach ($joinParts[$originAlias] as $joinPart) {
169169
/** @var Join $joinPart */
170-
$joinString = str_replace($aliases, $replacements, $joinPart->getJoin());
170+
$joinString = preg_replace($this->buildReplacePatterns($aliases), $replacements, $joinPart->getJoin());
171171
$pos = strpos($joinString, '.');
172172
if (false === $pos) {
173173
if (null !== $joinPart->getCondition() && null !== $this->resourceClassResolver && $this->resourceClassResolver->isResourceClass($joinString)) {
174174
$newAlias = $queryNameGenerator->generateJoinAlias($joinPart->getAlias());
175175
$aliases[] = "{$joinPart->getAlias()}.";
176176
$replacements[] = "$newAlias.";
177-
$condition = str_replace($aliases, $replacements, $joinPart->getCondition());
177+
$condition = preg_replace($this->buildReplacePatterns($aliases), $replacements, $joinPart->getCondition());
178178
$join = new Join($joinPart->getJoinType(), $joinPart->getJoin(), $newAlias, $joinPart->getConditionType(), $condition);
179179
/* @phpstan-ignore-next-line */
180180
$queryBuilderClone->add('join', [$replacement => $join], true);
@@ -187,12 +187,19 @@ private function getQueryBuilderWithNewAliases(QueryBuilder $queryBuilder, Query
187187
$newAlias = $queryNameGenerator->generateJoinAlias($association);
188188
$aliases[] = "{$joinPart->getAlias()}.";
189189
$replacements[] = "$newAlias.";
190-
$condition = str_replace($aliases, $replacements, $joinPart->getCondition() ?? '');
190+
$condition = preg_replace($this->buildReplacePatterns($aliases), $replacements, $joinPart->getCondition() ?? '');
191191
QueryBuilderHelper::addJoinOnce($queryBuilderClone, $queryNameGenerator, $alias, $association, $joinPart->getJoinType(), $joinPart->getConditionType(), $condition, $originAlias, $newAlias);
192192
}
193193

194-
$queryBuilderClone->add('where', str_replace($aliases, $replacements, (string) $wherePart));
194+
$queryBuilderClone->add('where', preg_replace($this->buildReplacePatterns($aliases), $replacements, (string) $wherePart));
195195

196196
return $queryBuilderClone;
197197
}
198+
199+
private function buildReplacePatterns(array $aliases): array
200+
{
201+
return array_map(static function (string $alias): string {
202+
return '/\b'.preg_quote($alias, '/').'/';
203+
}, $aliases);
204+
}
198205
}

src/Serializer/AbstractItemNormalizer.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -765,10 +765,6 @@ protected function getAttributeValue($object, $attribute, $format = null, array
765765
unset($context['resource_class']);
766766

767767
if ($type && $type->getClassName()) {
768-
if (!\is_object($attributeValue) && null !== $attributeValue) {
769-
throw new UnexpectedValueException('Unexpected non-object value for object property.');
770-
}
771-
772768
$childContext = $this->createChildContext($context, $attribute, $format);
773769
unset($childContext['iri']);
774770

0 commit comments

Comments
 (0)