Fixed database queries to address issue where old parent nodes were not found.
I encountered an issue where none of the nodes copied from Navee retained their structure.
After debugging I found there was an issue with the query to find the old node's parent appeared to be incorrect and not returning the expected result. By specifying the structureId, finding the structure node that encompasses the lft and rgt and ordering by the smallest difference between rgt - lft this fixed the issue for me.
Once the database query to find the parent was addressed I had issues still with not rebuilding the hierarchy. After looking at the hydrated $NaveeElement I found the IDs were correct for the first dozen or so results but were wrong after that. The issue appeared to be the navee_nodes table uses id to reflect the element.id which was stored as the $oldNodeId whereas content.id is its own ID and not the elementId. When hydrated the content.id was overriding the element.id value. Specifying the selected columns addressed this for me.
Fixed database queries to address issue where old parent nodes were not found.
I encountered an issue where none of the nodes copied from Navee retained their structure.
After debugging I found there was an issue with the query to find the old node's parent appeared to be incorrect and not returning the expected result. By specifying the
structureId
, finding the structure node that encompasses thelft
andrgt
and ordering by the smallest difference betweenrgt - lft
this fixed the issue for me.Once the database query to find the parent was addressed I had issues still with not rebuilding the hierarchy. After looking at the hydrated
$NaveeElement
I found the IDs were correct for the first dozen or so results but were wrong after that. The issue appeared to be thenavee_nodes
table usesid
to reflect theelement.id
which was stored as the$oldNodeId
whereascontent.id
is its own ID and not theelementId
. When hydrated thecontent.id
was overriding theelement.id
value. Specifying the selected columns addressed this for me.