All Questions
789 questions
1
vote
2
answers
62
views
Symfony serializer with array of entities
I have 2 DTO objects and I need to convert json to it:
class SomeDTO
{
public function __construct(
#[SerializedName('some_property')]
private string $someProperty,
#[...
0
votes
1
answer
151
views
How to map PUT/POST Request with Symfonys #[MapRequestPayload] Attribute to nested DTO
I am currently playing around with the #[MapRequestPayload] Attribute of Symfony. I used it before for flat DTOs, worked like a charm. Now i am trying to map a nested DTO. My SearchResult DTO has one ...
0
votes
0
answers
374
views
MapRequestPayload cannot map a nested object request body to an Entity
I'm developing a Symfony app and want to use the MapRequestPayload attribute to map the following JSON payload
{
"article": {
"title": "How to train your dragon",
...
0
votes
1
answer
274
views
MapRequestPayload cannot acces information with hyphen
I have an app in Symfony 6.4 where I use attribute MapRequestPayload to parse incoming data. Until now it worked fine but I've started using external service (mailgun) to get some data and there is a ...
0
votes
0
answers
92
views
Doctrine Mysql JsonType Column value returns empty array despite data present
I have Symfony application which I recently Migrated (Only Symfony packages - from 5.4 to 6.4) and one entity has a field of type object A that extends JsonType from Doctrine and is behind 2 ...
1
vote
1
answer
1k
views
MapRequestPayload nested DTOs
I want to parse JSON Requests into nested DTOs with MapRequestPayload. The goal is to have the data into the DTOs validated.
Example JSON:
{
"meta": {
"locale": "...
1
vote
0
answers
205
views
Symfony / EasyAdmin : CollectionType display key/value
I store json in a field
{
'key': {
'value': 42,
'field': 'IntegerField'
},
'key2': {
'value': 'myValue',
'field': 'TextField'
},
}
It's a Collection ...
0
votes
2
answers
544
views
SYMFONY DESERIALIZER ERROR: The type of the attribute for class must be one of "Object[]" but ("array" given)
I have a Tags model (not an entity) with a child Tag model array property.
class Tags
{
private array $tags;
public function addTag(Tag $tag): bool{}
public function removeTag(Tag $tag): ...
0
votes
1
answer
447
views
API Platform only accepts arrays for doctrine type json_array, how can you save strings?
I have a Symfony 4.4 doctrine class like this:
/**
* @ApiResource(
* collectionOperations={
* "GET" = {"security"="is_granted('ROLE_ADMIN')"},
* ...
0
votes
1
answer
159
views
Sum values from a JSON with Symfony QueryBuilder
I have an issue with a query suming values stored in a Json array.
I have a Sheet entity that is joined with a Valid entity. Valid has a field "$dac" corresponding to the Json array. Here is ...
1
vote
2
answers
446
views
Symfony 6 Deserializing JSON array
I receive a JSON string containing an array of objects similar to this:
{"expert": "foo", "username": "bar", "activity": [{"action": "...
0
votes
0
answers
572
views
Symfony 6 : JSON login invalid credentials
I have a problem with the JSON login of symfony.
I follow this : https://symfony.com/doc/6.3/security.html#json-login step by step but it still don't work with this message that make me crazy:
...
-1
votes
1
answer
199
views
My JSON response returns the wrong format. Error : SyntaxError: Unexpected token '<', "<!-- [Synt"... is not valid JSON
I want to display in AJAX a list of people to add to these friends in a Symfony 6.2 project.
At first everything worked but recently the error quoted in the title is displayed when the event is ...
0
votes
1
answer
291
views
Symfony 3.4 returns plain text header with JSON response
I'm working on a project using Symfony 3.4 and sometimes when I make a request that should return only JSON, I get a response with an HTTP header that looks like plain text. Here's an example response:...
0
votes
1
answer
324
views
Symfony - How to specify root to deserialize json array to object using JMS\Serializer
I receive json responses from a certain server to API requests in this format:
{
"data": {
#result here
}
}
But I need to do deserialization of the result itself inside "data&...