We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
This is my code:
$test_model = (new \TestModel); CLI::write('INSERT_TEST tes_id + tes_txt' , 'red'); $test_1 = (new \App\Entities\Test()); $test_1->tes_id = rand(20,200); $test_1->tes_txt = '111' . microtime(); CLI::write(json_encode($test_1->toRawArray())); CLI::write($test_model->save($test_1)); CLI::write('VALIDATION ERRORS: ' . print_r($test_model->errors(true), true)); CLI::write('INSERT_TEST tes_id + tes_txt' , 'red'); $test_2 = (new \App\Entities\Test()); $test_2->tes_id = rand(20,200); $test_2->tes_txt = null; CLI::write(json_encode($test_2->toRawArray())); CLI::write($test_model->save($test_2)); // PRODUCES INSERT INTO `t_test` (`tes_id`) VALUES (138) CLI::write('VALIDATION ERRORS: ' . print_r($test_model->errors(), true)); // NO ERRORS!
and my model has validation rules like:
protected $validationRules = [ 'tes_txt' => 'required|min_length[2]', 'tes_json' => 'permit_empty|valid_json' ];
Results for spark code:
CodeIgniter CLI Tool - Version 4.0.0-alpha.5 - Server-Time: 2019-03-01 08:55:30am INSERT_TEST tes_id + tes_txt {"tes_id":139,"tes_txt":"1110.12893900 1551430530","tes_json":null,"tes_created_at":null,"tes_updated_at":null} 139 INSERT INTO `t_test` (`tes_id`, `tes_txt`) VALUES (139, '1110.12893900 1551430530') VALIDATION ERRORS: INSERT_TEST tes_id + tes_txt {"tes_id":138,"tes_txt":null,"tes_json":null,"tes_created_at":null,"tes_updated_at":null} 138 INSERT INTO `t_test` (`tes_id`) VALUES (138) VALIDATION ERRORS:
Unfortunately as long as tes_txt = NULL $test_2 is passing validation. If I change it to '' or 'x' validation is working (required or min_length[2])
The text was updated successfully, but these errors were encountered:
Merge pull request #1930 from atishamte/model
c51dea3
Model Changes w.r.t. #1773
No branches or pull requests
This is my code:
and my model has validation rules like:
Results for spark code:
Unfortunately as long as tes_txt = NULL $test_2 is passing validation. If I change it to '' or 'x' validation is working (required or min_length[2])
The text was updated successfully, but these errors were encountered: