title: Cakephp 4.x Conditional $rules->isUnique(['email'] only works on add, not udate operations in buildRules
body: <p>Trying to implement conditional validation logic thru buildRules.  Logic works on add, but not on update operations.  I have verified that the rule returns true on update and false on add.</p>
  <p>My Table Model:</p>
  <pre><code>namespace App\Model\Table;
  
  use Cake\ORM\Query;
  use Cake\ORM\RulesChecker;
  use Cake\ORM\Rule\IsUnique;
  use Cake\ORM\Table;
  use Cake\Validation\Validator;
  use Cake\Event\EventInterface;
  use ArrayObject;
  use Cake\Error\Debugger;
  use Cake\Log\Log;
  </code></pre>
  <pre><code>   public function buildRules(RulesChecker $rules): RulesChecker {     
        $rules-&gt;add(function ($entity, $options) use($rules) {
           if ($entity-&gt;send_email == 'Y') {
              $rule = $rules-&gt;isUnique(['email'], 'The email should be unique for MailChimp'); // Works on add only
              return $rule($entity, $options); // Works on add only
           }
           return true;
        }, 'email');
        return $rules;
     }
  </code></pre>
  <p>I have tried</p>
  <pre><code>    public function buildRules(RulesChecker $rules): RulesChecker {
            $rules-&gt;add(function ($entity, $options) use($rules) {
               if ($entity-&gt;send_email == 'Y') {
                  $rules-&gt;add($rules-&gt;isUnique(
                        ['email'], 'Error Message'
                  ));
                  return $rules;
               }
               return true;
            }, 'email');
            return $rules;
         }
  </code></pre>
  <p>Which on edit displays the flash message from the controller.
  But on add displays no message and stays on the edit form.</p>
  <p>Any suggestions or educational pointers will be greatly appreciated.
  Sorry if this is not formatted correctly</p>
  <p><strong>Update:</strong>
  | Name       | Type              | Collation           |
  | ----------------| ----------------- | -------------------- |
  | email           | varchar(255) | utf8_general_ci |
  | send_email | varchar(1)     | utf8_general_ci |</p>
  <p>The purpose is to not let an update or add to the database if the email already exists and send_email flag == &quot;Y&quot;
  It is valid for the email to exist multiple times as long as the send_email flag == &quot;N&quot;
  The return true is is being generated in the from the unique check</p>
  <pre><code>    $rule = $rules-&gt;isUnique(['email'], 'The email should be unique for MailChimp'); // Works on add only
      Debugger::dump($rule($entity, $options));
      return $rule($entity, $options);
  </code></pre>