Skip to content

Bug: Database connection #3043

Description

@antevidovic385

Describe the bug
This is problem in DEVELOPMENT environment in app that use multiple database.
I try to insert record in other database table (not default) and insert failed when I use is unique validation rule 'name' => 'required|is_unique[' . $this->table . '.name], set up on model.

During the validation process is used default DB-group, not custom that is set $this->db = \Config\Database::connect('custom_database);.

bug_validation_on_default

database_group

This problem does not appear on production and testing environment or on dev env when I don't use unique validation rule

CodeIgniter 4 version
CI 4

Expected behavior, and steps to reproduce if appropriate
I expected that the record will be insert in custom database table

Context

  • Ubuntu 16
  • Web server: Apache 2.0 Handler
  • PHP version: 7.4

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugVerified issues on the current code behavior or pull requests that will fix them

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions