Created
August 11, 2020 18:29
-
-
Save glaphire/c12528ad90c5f49873780b2705f89286 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Serializer\Normalizer; | |
use App\Pagination\PaginatedCollection; | |
use Symfony\Component\Serializer\Normalizer\NormalizerInterface; | |
use Symfony\Component\Serializer\Normalizer\PropertyNormalizer; | |
class PaginatedCollectionNormalizer extends PropertyNormalizer implements NormalizerInterface | |
{ | |
/** | |
* {@inheritdoc} | |
* | |
* @param array $context options that normalizers have access to | |
*/ | |
public function supportsNormalization($object, string $format = null, array $context = []) | |
{ | |
//Я не знаю что тут сделать, чтобы объект нормализировался корректно | |
$data = $this->normalizer->normalize($object, $format, $context); | |
return $data; | |
} | |
public function normalize($object, string $format = null, array $context = []) | |
{ | |
return $object instanceof PaginatedCollection; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment