More than one synonym not parsed
kayATcu opened this issue · comments
@featdd i think i found the problem and a solution....
--- vendor/featdd/dpn-glossary/Classes/Service/ParserService.php 2024-02-18 21:15:02.000000000 +0100
+++ patches/ParserService-new.php 2024-03-01 11:10:00.536245476 +0100
@@ -405,8 +405,9 @@
if ($isParseSynonyms) {
$synonymTermObject = clone $termObject;
+ $allSynonyms = $termObject->getSynonyms()->toArray();
/** @var \Featdd\DpnGlossary\Domain\Model\Synonym $synonym */
- foreach ($termObject->getSynonyms() as $synonym) {
+ foreach ($allSynonyms as $synonym) {
$synonymTermObject->{
($this->settings['useTermForSynonymParsingDataWrap'] ?? false)
? 'setParsingName'
Greetings,
Kay
Hi @kayATcu,
I couldn't believe my eyes first when I reproduced this and struggled to find an explanation, this is really a fine piece of an edge case. 😅
The issue was that I build a nested iteration over the synonym ObjectStorage, because inside the iteration the parser calls the "__toArray()" function of the term, wich also iterates over the ObjectStorage.
This is resulting in an array reset inside the ObjectStorage's internal array, messing up the overlaying iteration and so on...
Anyway here's the fix: 86a5767
I will also prepare an update for the TER.
Greetings
Daniel