我正在尝试修改已存在的节点中的字段集合,因此我可以在3的数组中的第一个元素上更改图像.问题是,当我执行entity_load或entity_load_single时,未设置hostEntity信息,所以当我做一个:
$field_collection_item->save(true); // with or without the true
// OR
$fc_wrapper->save(true); // with or without the true
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
Exception: Unable to save a field collection item without a valid reference to a host entity. in FieldCollectionItemEntity->save()
Run Code Online (Sandbox Code Playgroud)
当我print_r字段集合实体时,hostEntity:protected字段确实是空的.我的字段集如下设置:
这是我试图用来修改现有节点字段集合的代码:
$node = getNode(1352); // Get the node I want to modify
// There can be up to 3 experts, and I want to modify the image of the first expert
$updateItem = …Run Code Online (Sandbox Code Playgroud)