In _services_process_resource() at line 161 of services.resource_build.inc, there is code which makes relationships, actions, and targeted actions inherit properties from previously defined resources if they are not present. Relationships inherit from 'retrieve', while actions and targeted actions inherit from 'update'. I find this really confusing. I'd rather have all the properties be explicitly stated in the resource definition, which is clearer and open to less confusion. I just lost a hour or so chasing down a problem where I had set a relationship's access callback to be nothing (implying it should use user_access()) but instead it kept getting replaced with the retrieve resource's access function. Even if the inheritance thing doesn't get pulled out, that is actively a bug.

Comments?

Comments

Hugo Wetterberg’s picture

Yeah, that feature is pretty logical, but nevertheless dubious in a Drupal context, as it's not a common Drupal pattern. The sensible thing would probably be to pull the inheritance stuff out of the D7 branch and fix the bug in D6.

voxpelli’s picture

I agree that it might get confusing so I'm in favor of removing it.

ygerasimov’s picture

I also think that it is confusing and inheritance should be removed.

gdd’s picture

Status: Active » Needs review
StatusFileSize
new2.1 KB

Patch

ygerasimov’s picture

StatusFileSize
new1.81 KB

A bit too much has been removed. We need to remove only inheritance part. Everything else should stay. Please review attached patch.

gdd’s picture

Version: 7.x-3.x-dev » 6.x-3.x-dev
Status: Needs review » Patch (to be ported)

Nice catch, this has been committed, marking for backport

kylebrowning’s picture

Status: Patch (to be ported) » Closed (fixed)

This is already done in 6.x actually. IM not sure if it never made it to the 7.x version, or if someone removed it, but its gone.