Git Product home page Git Product logo

Comments (6)

jdeniau avatar jdeniau commented on August 30, 2024 1

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.

jdeniau avatar jdeniau commented on August 30, 2024

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.

jdeniau avatar jdeniau commented on August 30, 2024

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.

rubiodamian avatar rubiodamian commented on August 30, 2024

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.

rubiodamian avatar rubiodamian commented on August 30, 2024

Works perferctly , Awesome!

from rest-client-sdk.

jdeniau avatar jdeniau commented on August 30, 2024

0.29.0 released with the fix

from rest-client-sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.