Due to the change of entity_property_values_create_entity() in #1261192: Loosen entity_property_values_create_entity() the RESTWS tests fail for creating entities with unknown properties. I think we should keep the old behaviour as the service interface should be enforced by RESTWS. Unknown properties could have unknown side effects or maybe even security implications if they get into system.
So here is a patch that fixes the entity creation operation.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | 1303000-restws-entity-create.patch | 1.56 KB | klausi |
| #2 | 1303000-restws-entity-create.patch | 1.72 KB | klausi |
| restws-entity-create.patch | 823 bytes | klausi |
Comments
Comment #1
klausiok, fago suggested to keep entity_property_values_create_entity() as it just works properly for $values arrays. So better do a comparison on the property info and the incoming values.
Comment #2
klausiNew patch: Compares incoming properties manually to the defined property info. Code is quite long for such a simple task :(
Comment #3
fagoPatch looks good to me. Maybe you can shorten the code by using the wrapper a bit, though.
E.g. you can use a wrapper like that to get the properties of a certain bundle:
Comment #4
fagoor even better, we should not rely on the bundle that is incoming .. Thus just do:
Comment #5
klausiUsing the property info from a wrapper makes it only a little shorter. The id is not available, as this is a create operation.
Comment #6
klausiCommitted an even shorter version, thx fago for the help. See http://drupalcode.org/project/restws.git/commit/8a4e96c