Skip to content

Commit

Permalink
IBX-7579:Richtext: Rows are added to ezurl_object_link on every save
Browse files Browse the repository at this point in the history
  • Loading branch information
vidarl committed Feb 13, 2024
1 parent 314fd1f commit 5aa3975
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/lib/eZ/FieldType/RichText/RichTextStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,10 @@ public function storeFieldData(VersionInfo $versionInfo, Field $field, array $co

$urlIdMap = $this->gateway->getUrlIdMap(array_keys($urlSet));
$contentIds = $this->gateway->getContentIds(array_keys($remoteIdSet));
$urlLinkSet = [];
$urlLinkSet = $this->gateway->getUrlsFromUrlLink(
$field->id,
$versionInfo->versionNo
);

foreach ($links as $index => $link) {
list(, $scheme, $url, $fragment) = $linksInfo[$index];
Expand Down
10 changes: 10 additions & 0 deletions src/lib/eZ/FieldType/RichText/RichTextStorage/Gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,16 @@ public function insertUrl($url)
return $this->urlGateway->insertUrl($url);
}

/**
* Return a list of URLs used by the given field and version.
*
* @return bool[] An array of URLs, with urls as keys
*/
public function getUrlsFromUrlLink(int $fieldId, int $versionNo): array
{
return $this->urlGateway->getUrlsFromUrlLink($fieldId, $versionNo);
}

/**
* Creates link to URL with $urlId for field with $fieldId in $versionNo.
*
Expand Down

0 comments on commit 5aa3975

Please sign in to comment.