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
My database config is:
public $defaultGroup = 'defaultZT'; public $defaultZT = ['my old database credentials']; public $defaultNEW = ['my new database credentials'];
and simple model class...
class AdminGroupModel extends \CodeIgniter\Model { protected $DBGroup = 'defaultNEW'; protected $table = 't_admin_group'; protected $primaryKey = 'agr_identifier'; protected $returnType = 'App\Entities\Admin\AdminGroup'; protected $allowedFields = [ 'agr_identifier', 'agr_description' ]; protected $validationRules = [ 'agr_identifier' => 'required|min_length[1]|max_length[16]|regex_match[/[0-9a-zA-Z]{1,16}/]|is_unique[t_admin_group.agr_identifier,agr_identifier,{agr_identifier}]', 'agr_description' => 'required|max_length[512]', ]; }
When I am trying to save (new \AdminGroupModel)->save($entity); i get an exception:
mysqli_sql_exception #1146 Table 'myolddatabasename.t_admin_group' doesn't exist
which obviously means it tried to connect my old database.... i noticed that validation rule is_unique causes this exception.
The text was updated successfully, but these errors were encountered:
Update Model.php
7088c16
Fixes codeigniter4#1326 - passing DBGroup do Validation.
Update Validation.php
7a30a8f
Adding DBGroup to $data and passing it to processRules. codeigniter4#1326
Update Rules.php
37a7f66
Finally passing correct DBGroup to Database::connect; codeigniter4#1326
No branches or pull requests
My database config is:
and simple model class...
When I am trying to save (new \AdminGroupModel)->save($entity); i get an exception:
which obviously means it tried to connect my old database.... i noticed that validation rule is_unique causes this exception.
The text was updated successfully, but these errors were encountered: