Closed (fixed)
Project:
Backbone
Version:
7.x-1.x-dev
Component:
Drupal/PHP Code
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
4 May 2012 at 14:43 UTC
Updated:
6 Sep 2012 at 01:31 UTC
To reproduce:
var m = new Drupal.Backbone.Models.Node;
m.set({nid: 1});
m.fetch();
m.save({title: 'new title'});Examining the PUT request, the sent values are correct, so it appears to be something on the Drupal/PHP side. Bellow is the JSON sent in the request
{
"node":{
"nid":"1",
"vid":"1",
"uid":"1",
"title":"new title",
"log":"",
"status":"0",
"comment":"1",
"promote":"0",
"sticky":"0",
"type":"article",
"language":"und",
"created":"1336140139",
"changed":"1336141992",
"tnid":"0",
"translate":"0",
"revision_timestamp":"1336141992",
"revision_uid":"1",
"body":{
"und":[
{
"value":"Super duper!!!",
"summary":"",
"format":"filtered_html",
"safe_value":"<p>Super duper!!!</p>\n",
"safe_summary":""
}
]
},
"field_tags":[
],
"field_image":[
],
"rdf_mapping":{
"field_image":{
"predicates":[
"og:image",
"rdfs:seeAlso"
],
"type":"rel"
},
"field_tags":{
"predicates":[
"dc:subject"
],
"type":"rel"
},
"rdftype":[
"sioc:Item",
"foaf:Document"
],
"title":{
"predicates":[
"dc:title"
]
},
"created":{
"predicates":[
"dc:date",
"dc:created"
],
"datatype":"xsd:dateTime",
"callback":"date_iso8601"
},
"changed":{
"predicates":[
"dc:modified"
],
"datatype":"xsd:dateTime",
"callback":"date_iso8601"
},
"body":{
"predicates":[
"content:encoded"
]
},
"uid":{
"predicates":[
"sioc:has_creator"
],
"type":"rel"
},
"name":{
"predicates":[
"foaf:name"
]
},
"comment_count":{
"predicates":[
"sioc:num_replies"
],
"datatype":"xsd:integer"
},
"last_activity":{
"predicates":[
"sioc:last_activity_date"
],
"datatype":"xsd:dateTime",
"callback":"date_iso8601"
}
},
"cid":"0",
"last_comment_timestamp":"1336140139",
"last_comment_name":null,
"last_comment_uid":"1",
"comment_count":"0",
"name":"root",
"picture":"0",
"data":"b:0;",
"path":"http://t.dev/node/1"
}
}
Comments
Comment #1
setvik commentedLooks like this is a Services issue:
http://drupal.org/node/1511662
Comment #2
ethanw commentedThis should now be resolved, as of http://drupalcode.org/project/backbone.git/commit/8ad2b92.
Addressed by adding a flexible JSON processor system that lets individual fields have custom processors assigned to them and run when converting to the pre-JSON object format.
Currently the drupalbackbone-services.js module only has one, for booleans, but others are possible and probably likely.