Comments (8)
Can you create a gist with your entity classes?
from core.
Sure: https://gist.github.com/47f5040f01a265921048.git.
from core.
Does #64 fix the issue?
from core.
Problem solved thanks again and sorry for the late check!
from core.
Seems like a was a bit too hasty. But it's rather a question than an issue. I get the expected behaviour with the following declaration:
resource.job:
parent: api.resource
arguments: [ ApiBundle\Entity\Job ]
calls:
- method: initNormalizationContext
arguments: [ { groups: [ user ] } ]
tags: [ { name: api.resource } ]
resource.mandate:
parent: api.resource
arguments: [ ApiBundle\Entity\Mandate ]
tags: [ { name: api.resource } ]
resource.user:
parent: api.resource
arguments: [ ApiBundle\Entity\User ]
calls:
- method: initNormalizationContext
arguments: [ { groups: [ user ] } ]
tags: [ { name: api.resource } ]
As you can see I added the normalization context in both User
and Jobs
. I that the expected behaviour?
I first thought than when you were using a context it applied on all entities, i.e. if I have a relation between User
- Job
- Mandate
and when I get Users
with a user
context, it will show only the attributes on which the serialization group user
is applied but for the three entities.
Besides solving my problem this way causes another problem. Indeed if I check Job
, then now the
{
"@context": "\/api\/contexts\/Job",
"@id": "\/api\/jobs\/1",
"@type": "Job",
"title": "Resident Agitator",
"abbreviation": "IU",
"enabled": true,
"user": {"all the attributes matching the `user` serialization group are shown, basically it's the same object as when I directly request the user endpoint."},
"mandate": null
}
Instead of the wished result:
{
"@context": "\/api\/contexts\/Job",
"@id": "\/api\/jobs\/1",
"@type": "Job",
"title": "Resident Agitator",
"abbreviation": "IU",
"enabled": true,
"user": "\/api\/users\/43",
"mandate": null
}
from core.
It's a bug. The intended behavior is the one you described.
from core.
hello
I still reproduce the issue
It seems the serialization groups in relations are not managed correctly
there is a pending fix about it ?
Thank you
from core.
@sebdec This issue is about v1.0, which means it's really old and lots of things have changed since then. Please open a new issue (if there is not already one).
from core.
Related Issues (20)
- Some POST on ApiResource with async messenger and output false are broken in 3.3 HOT 1
- 'openapi' key doesn't work in getDescription method ApiPlatform\Doctrine\Orm\Filter\FilterInterface HOT 1
- MutationResolverInterface no longer working properly in v3.3 HOT 10
- Separate DTOs for input and output with different id fields fail HOT 3
- BC break in 3.3.x: resource_class has been changed for DTOs HOT 10
- Multiple ValidationContext : Wrong Swagger documentation HOT 1
- NumericFilter: "value is out of range for type integer" sql exception HOT 1
- Conflict between `original_data` cloning and application cloning in WriteListener HOT 4
- Upgrade from 2.7.16 to 2.7.18 omits "operation" in JSONLD context HOT 1
- cannot perform GraphQL sub-selections on non-doctrine resource collections HOT 10
- `property` field of FilterInterface::getDescription - string only? HOT 5
- Validation from DTO before resolver HOT 14
- Swagger Docs jsonopenapi format return HTML HOT 5
- Mixing IRIs between resources and sub-resources when using DTO HOT 2
- Doctrine ODM SearchFilter with embedded documents HOT 3
- Asset mapper warnings HOT 9
- Attempted to call an undefined method named "withParameterName" of class "ApiPlatform\Metadata\ApiProperty" HOT 1
- OpenAPI on calculated field add an extra `items` fields even if `openApiContext` define an object HOT 3
- Validation doesn't work proppperly with strict types HOT 1
- Add a way to configure default strategy mode for the SearchFilter
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from core.