Comments (6)
Started to work on this in https://github.com/mapado/rest-client-sdk/compare/jd-fix-issue75
It should work with ManyToOne relation, but not on OneToMany relation.
It's easier than it looked liked first, you just have to set @Rest\Entity
on both your entities and configure a @Rest\ManyToOne
relation on Agentes::tipoCuil
I will work on OneToMany relations tomorrow
from rest-client-sdk.
No problem for the bad english, and thank you for the issues, it help improving the project 👍
About your issue, if I understood correctly:
You have two entities Agentes
and TipoCuil
, but your TipoCuil
entity does not have any endpoint nor iri exposed ?
You only have the endpoint: /agentes
and /agentes/{id}
but no /tipocuil
nor /tipocuil/{id}
am I right ?
If so, I think your TipoCuil
entity should not have the annotation @Rest\Entity
If I still understand correctly, you use the Rest\Entity
annotation mainly for deserialization purpose, but your Agentes::tipoCuil
relation could only be a simple array, it would work fine, am I right ?
If so, the Rest\Entity
is like a helper for deserialization. I will think about it today, if it's more a serializer think and if I have a solution for you, or if I push something to treat this case.
from rest-client-sdk.
Well as I read your stacktrace, it looks like there is a call to https://github.com/mapado/rest-client-sdk/blob/master/src/Model/Serializer.php#L132, with the string CDI
as parameter. So it seems like it's not an object ?
Can you paste the return of your API call to help me diagnose your case ? (with Symfony and the rest-client-sdk-bundle
, you can see it in the web debug toolbar)
from rest-client-sdk.
You only have the endpoint: /agentes and /agentes/{id} but no /tipocuil nor /tipocuil/{id} am I right ?
exactly!
sometimes a relation entity on the api doesn't have an end point, becouse you just dont'n want to expose that entity. So it's still an relation entity but on the response it will be an array.
I know that, in this case "TipoCuil" isn't a Rest\entity but is still a relation entity.
Well as I read your stacktrace, it looks like there is a call to https://github.com/mapado/rest-client-sdk/blob/master/src/Model/Serializer.php#L132, with the string CDI as parameter. So it seems like it's not an object ?
yes, is an array. The serializer takes tipoCuil field and checks if the field is an Iri or not, so if TipoCuil is a Rest\enity the serialier will try to make a proxy for it. But, this field is only an entity not a rest\entity.
So that im trying to say is that, what if the relation entities can be a Rest\entity, an entity, an array or native types (int, string,etc)?
something like @rest\attribute(name="tipoCuil", type="object", class="App\Entity\TipoCuil")
or @rest\ManyToOne(name="tipoCuil", type="object", targetEntity="App\Entity\TipoCuil")
from rest-client-sdk.
Works perferctly , Awesome!
from rest-client-sdk.
0.29.0 released with the fix
from rest-client-sdk.
Related Issues (20)
- Persisting an entity with a ManyToOne relation does not convert related entity as IRI HOT 10
- Allow an ID instead of an IRI HOT 1
- Handle exceptions from API HOT 3
- paginated hydra collections support HOT 8
- retrieving a list of "abstracted" entities HOT 5
- More recent version of ocramius/proxy-manager HOT 5
- improve performance of related entities retrieval HOT 1
- Do not `PUT` if Unit of work returns an empty diff
- support of partial entities HOT 8
- page collection
- list available types
- Error if the setter does not exists
- Do not allow two `@Rest\Id` fields
- Proxy initializer function bug HOT 6
- Issue with `UnitOfWork` and query parameters
- Use property accessor
- Allow int as id in model
- DateTime : allow customer format
- DateTime : changing timezone
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 rest-client-sdk.