Skip to content

Commit eba014d

Browse files
committed
Merge branch '2.3'
2 parents 80ada83 + c9846f1 commit eba014d

14 files changed

+20
-29
lines changed

client-generator/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Client Generator is the fastest way to scaffold fully-featured webapps and native mobile apps from APIs supporting the [Hydra](http://www.hydra-cg.com/) format.
44

5-
![Screencast](images/demo.gif)
5+
![Screencast](images/client-generator-demo.gif)
66

77
*Generated React and React Native apps, updated in real time*
88

client-generator/react-native.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# React Native generator
22

3-
![List](images/list.png)
3+
![List](images/react-native/client-generator-react-native-list.png)
44

55
## Install
66

@@ -106,5 +106,5 @@ $ expo start
106106

107107
## Screenshots in iOS Simulator
108108

109-
![List](images/react-native/list.png) ![Show](images/react-native/show.png)
110-
![Add](images/react-native/add.png) ![Delete](images/react-native/delete.png)
109+
![List](images/react-native/client-generator-react-native-list.png) ![Show](images/react-native/client-generator-react-native-show.png)
110+
![Add](images/react-native/client-generator-react-native-add.png) ![Delete](images/react-native/client-generator-react-native-delete.png)

client-generator/react.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# React Generator
22

3-
![List screenshot](images/react/list.png)
3+
![List screenshot](images/react/client-generator-react-list.png)
44

55
The React Client Generator generates a Progressive Web App built with battle-tested libraries from the ecosystem:
66

@@ -123,8 +123,8 @@ That's all!
123123

124124
## Screenshots
125125

126-
![List](images/react/list.png)
127-
![Pagination](images/react/list-pagination.png)
128-
![Show](images/react/show.png)
129-
![Edit](images/react/edit.png)
130-
![Delete](images/react/delete.png)
126+
![List](images/react/client-generator-react-list.png)
127+
![Pagination](images/react/client-generator-react-list-pagination.png)
128+
![Show](images/react/client-generator-react-show.png)
129+
![Edit](images/react/client-generator-react-edit.png)
130+
![Delete](images/react/client-generator-react-delete.png)

core/serialization.md

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ services:
438438
```
439439

440440
The Normalizer class is a bit harder to understand, because it must ensure that it is only called once and that there is no recursion.
441-
To accomplish this, it needs to be aware of the Serializer instance itself.
441+
To accomplish this, it needs to be aware of the parent Normalizer instance itself.
442442

443443
Here is an example:
444444

@@ -450,15 +450,15 @@ namespace App\Serializer;
450450
451451
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
452452
use Symfony\Component\Serializer\Normalizer\ContextAwareNormalizerInterface;
453+
use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface;
454+
use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait;
453455
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
454-
use Symfony\Component\Serializer\SerializerAwareInterface;
455-
use Symfony\Component\Serializer\SerializerAwareTrait;
456456
457-
class BookAttributeNormalizer implements ContextAwareNormalizerInterface, SerializerAwareInterface
457+
class BookAttributeNormalizer implements ContextAwareNormalizerInterface, NormalizerAwareInterface
458458
{
459-
use SerializerAwareTrait;
459+
use NormalizerAwareTrait;
460460
461-
private const BOOK_ATTRIBUTE_NORMALIZER_ALREADY_CALLED = 'BOOK_ATTRIBUTE_NORMALIZER_ALREADY_CALLED';
461+
private const ALREADY_CALLED = 'BOOK_ATTRIBUTE_NORMALIZER_ALREADY_CALLED';
462462
463463
private $tokenStorage;
464464
@@ -473,13 +473,15 @@ class BookAttributeNormalizer implements ContextAwareNormalizerInterface, Serial
473473
$context['groups'][] = 'can_retrieve_book';
474474
}
475475
476-
return $this->passOn($object, $format, $context);
476+
$context[self::ALREADY_CALLED] = true;
477+
478+
return $this->normalizer->normalize($object, $format, $context);
477479
}
478480
479481
public function supportsNormalization($data, $format = null, array $context = [])
480482
{
481483
// Make sure we're not called twice
482-
if (isset($context[self::BOOK_ATTRIBUTE_NORMALIZER_ALREADY_CALLED])) {
484+
if (isset($context[self::ALREADY_CALLED])) {
483485
return false;
484486
}
485487
@@ -492,17 +494,6 @@ class BookAttributeNormalizer implements ContextAwareNormalizerInterface, Serial
492494
// for the current $object (book) and
493495
// return true or false
494496
}
495-
496-
private function passOn($object, $format = null, array $context = [])
497-
{
498-
if (!$this->serializer instanceof NormalizerInterface) {
499-
throw new \LogicException(sprintf('Cannot normalize object "%s" because the injected serializer is not a normalizer', $object));
500-
}
501-
502-
$context[self::BOOK_ATTRIBUTE_NORMALIZER_ALREADY_CALLED] = true;
503-
504-
return $this->serializer->normalize($object, $format, $context);
505-
}
506497
}
507498
```
508499

0 commit comments

Comments
 (0)