mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-08-29 22:30:01 +02:00
Fixed code for symfony 7
This commit is contained in:
parent
9eb825f89a
commit
7e6b931db4
6 changed files with 20 additions and 19 deletions
|
@ -122,7 +122,7 @@ class StructuralElementDenormalizer implements DenormalizerInterface, Denormaliz
|
|||
return $deserialized_entity;
|
||||
}
|
||||
|
||||
public function getSupportedTypes(): array
|
||||
public function getSupportedTypes(?string $format): array
|
||||
{
|
||||
//Must be false, because we use in_array in supportsDenormalization
|
||||
return [
|
||||
|
|
|
@ -24,19 +24,17 @@ namespace App\Serializer;
|
|||
|
||||
use App\Entity\Base\AbstractStructuralDBElement;
|
||||
use Symfony\Component\DependencyInjection\Attribute\Autowire;
|
||||
use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface;
|
||||
use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait;
|
||||
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
|
||||
use Symfony\Component\Serializer\Normalizer\ObjectNormalizer;
|
||||
|
||||
/**
|
||||
* @see \App\Tests\Serializer\StructuralElementNormalizerTest
|
||||
*/
|
||||
class StructuralElementNormalizer implements NormalizerInterface
|
||||
class StructuralElementNormalizer implements NormalizerInterface, NormalizerAwareInterface
|
||||
{
|
||||
public function __construct(
|
||||
#[Autowire(service: ObjectNormalizer::class)]private readonly NormalizerInterface $normalizer
|
||||
)
|
||||
{
|
||||
}
|
||||
use NormalizerAwareTrait;
|
||||
|
||||
public function supportsNormalization($data, ?string $format = null, array $context = []): bool
|
||||
{
|
||||
|
@ -48,7 +46,7 @@ class StructuralElementNormalizer implements NormalizerInterface
|
|||
return $data instanceof AbstractStructuralDBElement;
|
||||
}
|
||||
|
||||
public function normalize($object, ?string $format = null, array $context = []): mixed
|
||||
public function normalize($object, ?string $format = null, array $context = []): \ArrayObject|bool|float|int|string
|
||||
{
|
||||
if (!$object instanceof AbstractStructuralDBElement) {
|
||||
throw new \InvalidArgumentException('This normalizer only supports AbstractStructural objects!');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue