Programatically Changing Entry Types? I have a people channel that historically has used another field to decide if they're a "featured" person or not. 

The field set for "featured" people has now diverged from what a normal person has, so I'm wanting to create a new entry type in the people channel (featuredPeople) and programatically shift these people to the new entry type.

The field set is additive to the old one, so I'm hoping due to there being no field/structural changes this isn't too hard?

I've got the bones of a script together to do this, but I'm struggling to find any info on how to actually change the entry type on the entry.

# Get all people
$peopleCrit = Entry::find();
$peopleCrit-&gt;section = "people";
$people = $peopleCrit-&gt;all() ?? [];

foreach ($people as $person) {

    # If this was a "featured" person, shift to new featuredPeople entry type.
    if (historical "is featured" check) {

        # Move to featuredPeople entry type
        ???

    }

}


Any help would be greatly appreciated.
Something like this should work. I've also cleaned up the code a bit to be correct PHP syntax as my assumption is that you''ll be doing this in a module/plugin.

// Get all people entries
$entries = Entry::find()-&gt;section('people')-&gt;all();

foreach ($entries as $entry) {
    // If this was a "featured" historical person
    if ($entry-&gt;historical == 'featured') {
        // Change to featuredPeople entry type
        $entry-&gt;typeId = $featuredPeopleEntryTypeId;

        // Save entry
        Craft::$app-&gt;elements-&gt;saveElement($entry);
    }
}