Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create reservation provider function should receive entire object instead of just provider id #6

Open
mian3010 opened this issue Nov 19, 2014 · 4 comments

Comments

@mian3010
Copy link

I am implementing a provider for another API in which reservations are created using the ISBN-number of the book, and not the provider id. When ding_reservation calls the create function, it passes the provider id along. I cannot seem to load the TingEntity object when i only have the provider id.

The provider id the function receives looks like this; XXXXXXXX, but the id i need for calling ding_entity_load looks like this; XXXXXX-basis:XXXXXXXX where basis could be something else for different types of data.

I suggest that the create reservation function is passed the DingReservationReservable or TingEntity object as well as the provider id.

@kasperg
Copy link
Member

kasperg commented Nov 19, 2014

It seems odd to me that a provider API does not use the provider id for invoking other operations on entities. If that is the case for all operations I would consider using the ISBN as the provider ID throughout the provider implementation and not any other ID exposed by the provider.

If we are to alter the API then passing a provider ID or a DingReservationReservableEntity instance which would contain the entity and provider id would be fine by me.

@mian3010
Copy link
Author

I am not quite sure how the provider defines the provider id for an entity. As far as i can see, the provider id is just the localId field of a TingEntity (see ting_ting_object_load in profiles/ding2/modules/ting/ting.module) as received from Ting.

@kasperg
Copy link
Member

kasperg commented Nov 19, 2014

How about using hook_entity_load to set localId after loading the entity?

I think that passing a reservable is a better option, but I would like to get the opinion of other core developers before I recommend you to submit a pull request for such a change.

What do you think @cableman?

@kasperg kasperg closed this as completed Nov 19, 2014
@kasperg kasperg reopened this Nov 19, 2014
@kasperg
Copy link
Member

kasperg commented Nov 19, 2014

Oops :).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants