У меня есть объект ($ узел). Мне нужно обновить значение свойства объекта, сначала я сбрасываю его, а затем обновляю
unset($node->field_the_tranasction_status[LANGUAGE_NONE][0]);
$node->field_the_tranasction_status[LANGUAGE_NONE][0]['tid']=97;
Тем не менее, если я печатаю объект $ node впоследствии, используя print_r ($ node), свойство field_the_tranasction_status появляется дважды следующим образом, и это вызывает проблемы при вызове функции save ():
stdClass Object
(
[vid] => 1794
[uid] => 1
[title] => 2222 - 1
[status] => 0
[comment] => 0
[promote] => 0
[sticky] => 0
[nid] => 1471
[type] => donations
[language] => en
[created] => 1495892029
[changed] => 1495892068
[tnid] => 0
[translate] => 0
[revision_timestamp] => 1495892029
[revision_uid] => 1
[field_authorization_code] => Array
(
[und] => Array
(
[0] => Array
(
[value] =>
)
)
)
[field_amount] => Array
(
[und] => Array
(
[0] => Array
(
[value] => 1
)
)
)
[field_currency_iso] => Array
(
[und] => Array
(
[0] => Array
(
[value] => 840
)
)
)
[field_postal_address] => Array
(
[und] => Array
(
[0] => Array
(
[country] => PS
[administrative_area] =>
[sub_administrative_area] =>
[locality] => 2222
[dependent_locality] =>
[postal_code] =>
[thoroughfare] => 222
[premise] =>
[sub_premise] =>
[organisation_name] =>
[name_line] =>
[first_name] =>
[last_name] =>
[data] =>
)
)
)
[field_donor_name] => Array
(
[und] => Array
(
[0] => Array
(
[value] => 2222
[format] =>
[safe_value] => 2222
)
)
)
[field_credit_card_number] => Array
(
[und] => Array
(
[0] => Array
(
[value] => XXXXXXXXXXXX1111
)
)
)
[field_reference_number] => Array
(
[und] => Array
(
[0] => Array
(
[value] => null
)
)
)
[field_signature] => Array
(
[und] => Array
(
[0] => Array
(
[value] => null
)
)
)
[field_response_code] => Array
(
[und] => Array
(
[0] => Array
(
[value] => 2
)
)
)
[field_reason_code] => Array
(
[und] => Array
(
[0] => Array
(
[value] => 513
)
)
)
[field_signature_verified] => Array
(
[und] => Array
(
[0] => Array
(
[value] => 1
)
)
)
[field_reason_description] => Array
(
[und] => Array
(
[0] => Array
(
[value] => 3D Secure Message does not exist
)
)
)
[field_serial] => Array
(
[und] => Array
(
[0] => Array
(
[value] => 135
)
)
)
[field_email] => Array
(
[und] => Array
(
[0] => Array
(
[value] => [email protected]
[format] =>
[safe_value] => [email protected]
)
)
)
[field_phone] => Array
(
[und] => Array
(
[0] => Array
(
[value] => 2222
[format] =>
[safe_value] => 2222
)
)
)
[field_anonymous] => Array
(
[und] => Array
(
[0] => Array
(
[value] => 0
)
)
)
[field_campaign] => Array
(
)
[field_perk] => Array
(
)
[field_donation_program] => Array
(
[und] => Array
(
[0] => Array
(
[tid] => 96
)
)
)
[field_processed] => Array
(
[und] => Array
(
[0] => Array
(
[value] => No
)
)
)
[field_referral_url] => Array
(
[und] => Array
(
[0] => Array
(
[value] => https://www.taawon.org/donate
[format] =>
[safe_value] => https://www.taawon.org/donate
)
)
)
[field_transaction_status] => Array
(
)
[field_the_tranasction_status] => Array
(
[und] => Array
(
[0] => Array
(
[tid] => 101
)
)
)
[name] => admin
[picture] => 0
[data] => b:0;
[field_the_tranasction_status] => Array
(
[und] => Array
(
[0] => Array
(
[tid] => 98
)
)
)
[timestamp] => 1495892068
[publish_on] => 0
[unpublish_on] => 0
[xmlsitemap] => Array
(
[id] => 1471
[type] => node
[subtype] => donations
[loc] => node/1471
[language] => en
[access] =>
[status] => 0
[status_override] => 0
[lastmod] => 1495892068
[priority] => 0.5
[priority_override] => 0
[changefreq] => 0
[changecount] => 0
[status_default] => 0
[priority_default] => 0.5
)
)
Задача ещё не решена.
Других решений пока нет …