Parent are not set anymore after saveElement() In this code I try to create a new Entry and set a Parent to it.
The sectionId and the typeId are actually the same.
$navigationItem = new Entry();
$navigationItem-&gt;typeId = 4;
$navigationItem-&gt;sectionId = $navigationSection-&gt;id;
$navigationItem-&gt;title = $entry-&gt;title;
$navigationItem-&gt;setParent($herbsNavigationEntry);

$navigationItem-&gt;setFieldValue('navLink', '/tags/' . $entry-&gt;slug);

if (!Craft::$app-&gt;elements-&gt;saveElement($navigationItem)) {
    Craft::error('Couldn’t save the entry &quot;' . $entry-&gt;title . '&quot;', __METHOD__);
}

Before saving I get this:

But after the Craft::$app-&gt;elements-&gt;saveElement($navigationItem),
the parent disappears.
What did I wrong?
You need to use newParentId:
$navigationItem = new Entry();
$navigationItem-&gt;typeId = 4;
$navigationItem-&gt;sectionId = $navigationSection-&gt;id;
$navigationItem-&gt;title = $entry-&gt;title;
$navigationItem-&gt;newParentId = $herbsNavigationEntry-&gt;id;

$navigationItem-&gt;setFieldValue('navLink', '/tags/' . $entry-&gt;slug);

if (!Craft::$app-&gt;elements-&gt;saveElement($navigationItem)) {
    Craft::error('Couldn’t save the entry &quot;' . $entry-&gt;title . '&quot;', __METHOD__);
}