23 questions
1
vote
2
answers
192
views
How to use the array key as part of the hydrated value with the Symfony Serializer?
I have a json with collections of data like these :
{
"item_a": {
"name": "Item A",
"description": "...",
},
"item_b&...
0
votes
1
answer
82
views
PHP Symfony parse JSON response deserialize class constructor
I am trying to parse this JSON $response body =
{"low":{"networkFee":"0.00003"},"medium":{"networkFee":"0.0000428"},"high":{"...
1
vote
1
answer
640
views
How to pass context to Symfony Serializer?
I use Symfony Serializer component outside the framework. I have custom normalizer and I want to pass some extra context to it from the field like this:
class TariffDto
{
#[Context([...
0
votes
1
answer
111
views
Deserialize a json into an entity with Symfony Deserializer
I need to save a snapshot of an entity in a json field and I'm trying to deserialize it. The problem is that the result of the deserialization, has all the ID with null value. I dont want to insert ...
1
vote
1
answer
219
views
How to handle attributes for properties in custom serializer?
I have app based on symfony5.4. Inside this app I have a class for client like this:
class Client
{
#[Context([DateTimeNormalizer::FORMAT_KEY => 'Y-m-d'])]
public \DateTimeImmutable $...
0
votes
0
answers
572
views
Add property to DTO during serialization in Symfony
In a Controller, during serialization, using the Symfony Serializer, I need to dynamically add a property portal to an object, depending on an outside $portal value, which is a query argument.
$...
2
votes
1
answer
1k
views
Deserialize XML with array of objects
I'm trying to deserialize an XML-file to an object containing an array of other objects using Symfony Serializer, but can't get it to work with an array of objects under a specific key.
Here's a ...
3
votes
1
answer
1k
views
Method with a SerializedName attribute getting ignored when object is serialized with symfony serializer
I have a symfony serializer that i initialize this way :
$this->serializer = new Serializer(
[
new ArrayDenormalizer(),
new UidNormalizer(),
new BackedEnumNormalizer(),
...
0
votes
1
answer
531
views
Symfony serializer - Deserialize xml to array of objects
php Symfony serializer - Deserialize xml to array of objects
How deserialize xml with attributes to array of objects?
$string = '<?xml version="1.0" encoding="UTF-8" ?>
<...
0
votes
1
answer
551
views
Api Platform not persist OneToMany relation
I'm working with API Platform using Doctrine Inheritance and I have a problem persisting a OneToMany relation.
curl --location 'http://localhost/api/dummies' \
--header 'Content-Type: application/json'...
0
votes
1
answer
821
views
Symfony Serializer - Deserialize XML with attributes
I cant figure out how to deserialize this xml with the symfony serializer
<?xml version="1.0" encoding="UTF-8"?>
<issues>
<issue id="1" name="test&...
2
votes
1
answer
170
views
Add <!DOCTYPE to serialized xml from symfony serializer
There is xmlencoder in symfony serializer, by using that we achive this.
$data = ['foo' => 'Foo value'];
$encoder = new XmlEncoder();
$encoder->encode($data, 'xml');
// is encoded as follows:
//...