After going back over the screen-casts available on the Services group using Drupal 6 to start writing custom services I discovered that the custom "recipe_service" module example would return node id's (nids) in an array form and no actual content.
Heres how it went in the recipe_service.module:
function recipe_service_all($fields = array()) {
$result = db_query("SELECT nid FROM {node} WHERE type='recipe'");
$nodes = array();
while ($node = db_fetch_object($result)) {
$nodes[] = services_node_load(node_load($node), $fields);
}
return $nodes;
}
Outcome:
Array
(
[0] =>
[1] =>
[2] =>
[3] =>
)
Take out the "node_load" inside the "services_node_load" array and I get this:
function recipe_service_all($fields = array()) {
$result = db_query("SELECT nid FROM {node} WHERE type='recipe'");
$nodes = array();
while ($node = db_fetch_object($result)) {
$nodes[] = services_node_load($node, $fields);
}
return $nodes;
}
Outcome now:
Array
(
[0] => stdClass Object
(
[nid] => 1
[body] => n/a
[body_value] =>
)
[1] => stdClass Object
(
[nid] => 2
[body] => n/a
[body_value] =>
)
[2] => stdClass Object
(
[nid] => 3
[body] => n/a
[body_value] =>
)
[3] => stdClass Object
(
[nid] => 4
[body] => n/a
[body_value] =>
)
)
It's closer to what I want but it needs to spit out the information contained in the nodes, but don't think the function is looping over the right arrays. Been looking over the code but I'm not sure where to go with it now?
BeechyBoy
Comments
Comment #1
JoachimVdH commentedFor the cause of testing amfphp for dr6, I watched the tutorial and created everything step by step.
Where it goes wrong at the moment is the communication between the services and views.
When you load views.getviews from the services menu, you see the error.
Views is still being build, so i assume the services will connect on the right way with views when views is stable. ( and views services is modified to the new way of working with views)
so i think we have to be patient.
module versions:
Joachim
Comment #2
jody lynnThis is a result of a change in services module not amfphp.
Comment #3
carvalhar commentedso...i'm having the same problem....
is it working today?
almost one year after...
where do i get info about services functions?
thanks
Comment #4
snelson commentedTry changing:
to:
Should do it.