I am trying to programmatically update a node with a value from another entity. When I call
node_save, the function just "stops". There is nothing in watchdog or in my php_logs that would indicate that any issue was encountered.
$node = node_load($base_node->nid, FALSE, TRUE); $node->field_product[LANGUAGE_NONE] = array('product_id' => $entity->product_id->value()); dpm('This text prints.'); node_save($node); dpm('This text does not print.'); //This line is never executed.
I have tried a variety of methods for saving the node including using entitymetadatawrappers on
$node. So far, nothing I have tried has gotten me anywhere.
A few more details on what I have tried/am trying to do.
This field is a product reference field that I am adding a reference to.
There is nothing at all in the php logs or the watchdog logs.
I am trying to do this as a part of custom rules action. I was originally using the
add item to list action, but only one item was being added to the list (usually there will be 4-5). As a test, I tried to update and save the node manually (thus the code above).
I should have specified that part, but got a bit wrapped up in my own solution. Either way, it seems pretty odd to me.
Edit Part 2:
I have confirmed that the structure for
field_product is correct. I am also doing checks to make sure that I am not referencing a non-existent field, etc.
I wasn't originally using
dpms for debugging, it just seemed like the simplest way to communicate my issue. Originally I was doing some further processing on my data that was not being done. Since that further logic isn't pertinent to the problem, I added a
dpm as an example. There were no errors in the following logic and it wasn't dependent on the node save.