CakePHP 4 Search Collection: Search criterion triggered when not selected

I have a search collection that includes a callback that should not be triggered unless its checkbox is selected on my search form. Here is the code for the checkbox:

<?php echo $this->Form->control('mgr_sign', ['label' => 'Signed by manager', 'type' => 'checkbox'], ['empty' => ['' => '']]); ?>

Here is the callback in my search collection.

$this->add('mgr_sign', 'Search.Callback', [
    'callback' => function (\Cake\ORM\Query $query, array $args, \Search\Model\Filter\Base $filter) {
        // Return all work authorizations signed by a manager
        $query->where("Noncons.id IN(SELECT noncons.id FROM noncons WHERE app_manager_id != 0 AND deleted_record = 0)"); 
     }
]);

The problem is that this callback executes even when the checkbox is not selected, and my search results are inaccurate. I need to ensure that this callback only executes if the user checks the box. Debugging the query shows that it executes as an AND statement.

Got it sorted. I have to explicitly tell the Search component to set the empty value of the checkbox to 0 so that it’ll skip it if it’s not selected.

$this->loadComponent('Search.Search', [
        // Search enabled for index and search methods
        'actions' => ['index', 'search'],
        'emptyValues' => [
            'engr_sign' => '0',
        ],
    ]);