Set Structure Parent when creating Entry in Plugin I have Structure-type Section for entries and want to pragmatically populate a large list of multi-tiered entries.

I see you can create an entry like:

$entry = new EntryModel();
$entry-&gt;getContent()-&gt;title = 'New Page';
$entry-&gt;getContent()-&gt;body = null;

craft()-&gt;entries-&gt;saveEntry($entry);


What I want to do is add the parent(s) of the entry, something like:

$entry = new EntryModel();
$entry-&gt;getContent()-&gt;title = 'New Page';
$entry-&gt;getContent()-&gt;body = null;

// this entry would be a child in order of Sports -&gt; Tennis -&gt; This Entry
$entry-&gt;getContent()-&gt;parent = sports-&gt;tennis;

craft()-&gt;entries-&gt;saveEntry($entry);


Is there a way to do something like that?
This question is old, but the solution is: 

// look up parent with a ElementCriteriaModel

$parentCriteria = craft()-&gt;elements-&gt;getCriteria(ElementType::Entry);

$parentCriteria-&gt;search  = 'slug:'.$parentSlug; // whatever you have

$parent = $parentCriteria-&gt;find()[0];

$entry = new EntryModel();
$entry-&gt;sectionId = $section;

$entry-&gt;parentId = $parent-&gt;id; 

...