How can I conditionally resave entries based on the value of an entry's field in a Craft 3 Module/Plugin?
My working solution:

public function actionResaveEntries()
{
    $site = Craft::$app-&gt;sites-&gt;getSiteById(self::SITE_ID);
    $section = Craft::$app-&gt;sections-&gt;getSectionById(self::SECTION_ID);
    $entryType = Craft::$app-&gt;sections-&gt;getEntryTypeById(self::ENTRY_TYPE_ID);

    $entries = Entry::find()
        -&gt;siteId(self::SITE_ID)
        -&gt;sectionId(self::SECTION_ID)
        -&gt;typeId(self::COMP_ENTRY_TYPE_ID)
        -&gt;all();

    foreach ($entries as $entry) {
        // Set deadline
        $deadline = $entry-&gt;competitionJudgingEnd;
        // Check if after deadline
        $now = new DateTime();
        if ($now &gt; $deadline) {
            Craft::$app-&gt;getQueue()-&gt;push(new ResaveElements([
                'description' =&gt; Craft::t('app', 'Resaving {section}, {type} entries', [
                    'section' =&gt; $section, 'type' =&gt; $entryType-&gt;name,
                ]),
                'elementType' =&gt; Entry::class,
                'criteria' =&gt; [
                    'siteId' =&gt; $site-&gt;id,
                    'sectionId' =&gt; $section-&gt;id,
                    'typeId' =&gt; $entryType-&gt;id,
                    'status' =&gt; null,
                    'enabledForSite' =&gt; true
                ]
            ]));
            echo "Resaving entries\n"
        } else 
            echo "Not resaving entries\n";
        }
    }
}