I am attempting to validate a field that should hold US dollar amounts using the Validator method money(). I get the error "Call to undefined method Cake\Validation\Validator::money()".
I'm able to access the methods minLenthBytes() & naturalNumber() without the same error. I did see some issues on github regarding money() from 2016 but it looks they are closed. The cookbook indicates that money() should be there (https://api.cakephp.org/3.8/class-Cake.Validation.Validation.html#_money). I did find it in \vendor\cakephp\cakephp\src\Validation\Validation.php.
Here's my code
$validator
->numeric('ship_amt') //no error
->minLengthBytes('ship_amt', 25) //no error, testing only
->money('ship_amt', 'Please enter a valid monetary amount.') //error -> call to undefined method. Same error with or without message.
->naturalNumber('ship_amt') //no error, testing only
->greaterThanOrEqual('ship_amt', 0) //no error, testing only
->notEmptyString('ship_amt'); // no error, testing only
Here's the top portion of the debug log (I can provide more if needed):
[Error] Call to undefined method Cake\Validation\Validator::money()
#0 XXX\vendor\cakephp\cakephp\src\Validation\ValidatorAwareTrait.php(178): App\Model\Table\ProjectsTable->validationDefault(Object(Cake\Validation\Validator))
#1 XXX\vendor\cakephp\cakephp\src\Validation\ValidatorAwareTrait.php(151): Cake\ORM\Table->createValidator('default')
#2 XXX\vendor\cakephp\cakephp\src\View\Form\EntityContext.php(593): Cake\ORM\Table->getValidator('default')
#3 XXX\vendor\cakephp\cakephp\src\View\Form\EntityContext.php(504): Cake\View\Form\EntityContext->_getValidator(Array)
#4 XXX\vendor\cakephp\cakephp\src\View\Helper\FormHelper.php(1463): Cake\View\Form\EntityContext->getRequiredMessage('company_id')
#5 XXX\vendor\cakephp\cakephp\src\View\Helper\FormHelper.php(1354): Cake\View\Helper\FormHelper->_magicOptions('company_id', Array, false)
#6 XXX\vendor\cakephp\cakephp\src\View\Helper\FormHelper.php(1171):
Specs: CakePHP 3.8 on Windows Server 2012, PHP 7.3.1
I'm quite new to v3.x after being away for a few years. If there are any noob mistakes, my apologies. I'm feeling like a serious noob right now.
Thanks in advance for any assistance. It will be greatly appreciated.