function postStore($objectAttribute) { // Update url-object link $urlValue = $objectAttribute->content(); if (trim($urlValue) != '') { $urlID = eZURL::registerURL($urlValue); $objectAttributeID = $objectAttribute->attribute('id'); $objectAttributeVersion = $objectAttribute->attribute('version'); $db = eZDB::instance(); $db->begin(); $objectLinkList = eZURLObjectLink::fetchLinkObjectList($objectAttributeID, $objectAttributeVersion); // In order not to have duplicated links, delete existing ones that have been created during the version creation process // and create a clean one (we can't update url_id since there's no primary key). This fixes EZP-20988 if (!empty($objectLinkList)) { eZURLObjectLink::removeURLlinkList($objectAttributeID, $objectAttributeVersion); } $linkObjectLink = eZURLObjectLink::create($urlID, $objectAttributeID, $objectAttributeVersion); $linkObjectLink->store(); $db->commit(); } }