mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-08-29 06:18:26 +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
12
composer.lock
generated
12
composer.lock
generated
|
@ -3946,16 +3946,16 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "jbtronics/dompdf-font-loader-bundle",
|
"name": "jbtronics/dompdf-font-loader-bundle",
|
||||||
"version": "v1.1.3",
|
"version": "v1.1.4",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/jbtronics/dompdf-font-loader-bundle.git",
|
"url": "https://github.com/jbtronics/dompdf-font-loader-bundle.git",
|
||||||
"reference": "da01d9655826105d53f9d0e8ba4f9d838201dcb2"
|
"reference": "1b41014a2dd9e82ba6a62e61deeebe3cdc1eaf1f"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/jbtronics/dompdf-font-loader-bundle/zipball/da01d9655826105d53f9d0e8ba4f9d838201dcb2",
|
"url": "https://api.github.com/repos/jbtronics/dompdf-font-loader-bundle/zipball/1b41014a2dd9e82ba6a62e61deeebe3cdc1eaf1f",
|
||||||
"reference": "da01d9655826105d53f9d0e8ba4f9d838201dcb2",
|
"reference": "1b41014a2dd9e82ba6a62e61deeebe3cdc1eaf1f",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
@ -3995,9 +3995,9 @@
|
||||||
],
|
],
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/jbtronics/dompdf-font-loader-bundle/issues",
|
"issues": "https://github.com/jbtronics/dompdf-font-loader-bundle/issues",
|
||||||
"source": "https://github.com/jbtronics/dompdf-font-loader-bundle/tree/v1.1.3"
|
"source": "https://github.com/jbtronics/dompdf-font-loader-bundle/tree/v1.1.4"
|
||||||
},
|
},
|
||||||
"time": "2025-02-07T23:21:03+00:00"
|
"time": "2025-07-07T20:39:34+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "jbtronics/settings-bundle",
|
"name": "jbtronics/settings-bundle",
|
||||||
|
|
|
@ -41,7 +41,7 @@ class SelectTypeOrderExtension extends AbstractTypeExtension
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function configureOptions(OptionsResolver $resolver)
|
public function configureOptions(OptionsResolver $resolver): void
|
||||||
{
|
{
|
||||||
$resolver->setDefault('ordered', false);
|
$resolver->setDefault('ordered', false);
|
||||||
$resolver->setDefault('by_reference', function (Options $options) {
|
$resolver->setDefault('by_reference', function (Options $options) {
|
||||||
|
@ -50,7 +50,7 @@ class SelectTypeOrderExtension extends AbstractTypeExtension
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildView(FormView $view, FormInterface $form, array $options)
|
public function buildView(FormView $view, FormInterface $form, array $options): void
|
||||||
{
|
{
|
||||||
//Pass the data in ordered form to the frontend controller, so it can make the items appear in the correct order.
|
//Pass the data in ordered form to the frontend controller, so it can make the items appear in the correct order.
|
||||||
if ($options['ordered']) {
|
if ($options['ordered']) {
|
||||||
|
|
|
@ -100,7 +100,7 @@ final class TriStateCheckboxType extends AbstractType implements DataTransformer
|
||||||
* @return mixed The value in the transformed representation
|
* @return mixed The value in the transformed representation
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function transform(mixed $value)
|
public function transform(mixed $value): mixed
|
||||||
{
|
{
|
||||||
if (true === $value) {
|
if (true === $value) {
|
||||||
return 'true';
|
return 'true';
|
||||||
|
@ -142,7 +142,7 @@ final class TriStateCheckboxType extends AbstractType implements DataTransformer
|
||||||
*
|
*
|
||||||
* @return mixed The value in the original representation
|
* @return mixed The value in the original representation
|
||||||
*/
|
*/
|
||||||
public function reverseTransform(mixed $value)
|
public function reverseTransform(mixed $value): mixed
|
||||||
{
|
{
|
||||||
return match ($value) {
|
return match ($value) {
|
||||||
'true' => true,
|
'true' => true,
|
||||||
|
|
|
@ -122,7 +122,7 @@ class StructuralElementDenormalizer implements DenormalizerInterface, Denormaliz
|
||||||
return $deserialized_entity;
|
return $deserialized_entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getSupportedTypes(): array
|
public function getSupportedTypes(?string $format): array
|
||||||
{
|
{
|
||||||
//Must be false, because we use in_array in supportsDenormalization
|
//Must be false, because we use in_array in supportsDenormalization
|
||||||
return [
|
return [
|
||||||
|
|
|
@ -24,19 +24,17 @@ namespace App\Serializer;
|
||||||
|
|
||||||
use App\Entity\Base\AbstractStructuralDBElement;
|
use App\Entity\Base\AbstractStructuralDBElement;
|
||||||
use Symfony\Component\DependencyInjection\Attribute\Autowire;
|
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\NormalizerInterface;
|
||||||
use Symfony\Component\Serializer\Normalizer\ObjectNormalizer;
|
use Symfony\Component\Serializer\Normalizer\ObjectNormalizer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \App\Tests\Serializer\StructuralElementNormalizerTest
|
* @see \App\Tests\Serializer\StructuralElementNormalizerTest
|
||||||
*/
|
*/
|
||||||
class StructuralElementNormalizer implements NormalizerInterface
|
class StructuralElementNormalizer implements NormalizerInterface, NormalizerAwareInterface
|
||||||
{
|
{
|
||||||
public function __construct(
|
use NormalizerAwareTrait;
|
||||||
#[Autowire(service: ObjectNormalizer::class)]private readonly NormalizerInterface $normalizer
|
|
||||||
)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public function supportsNormalization($data, ?string $format = null, array $context = []): bool
|
public function supportsNormalization($data, ?string $format = null, array $context = []): bool
|
||||||
{
|
{
|
||||||
|
@ -48,7 +46,7 @@ class StructuralElementNormalizer implements NormalizerInterface
|
||||||
return $data instanceof AbstractStructuralDBElement;
|
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) {
|
if (!$object instanceof AbstractStructuralDBElement) {
|
||||||
throw new \InvalidArgumentException('This normalizer only supports AbstractStructural objects!');
|
throw new \InvalidArgumentException('This normalizer only supports AbstractStructural objects!');
|
||||||
|
|
|
@ -34,8 +34,11 @@ use Twig\TwigTest;
|
||||||
*/
|
*/
|
||||||
final class TwigCoreExtension extends AbstractExtension
|
final class TwigCoreExtension extends AbstractExtension
|
||||||
{
|
{
|
||||||
public function __construct(protected ObjectNormalizer $objectNormalizer)
|
private readonly ObjectNormalizer $objectNormalizer;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
{
|
{
|
||||||
|
$this->objectNormalizer = new ObjectNormalizer();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getFunctions(): array
|
public function getFunctions(): array
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue