CodeIgniter4 icon indicating copy to clipboard operation
CodeIgniter4 copied to clipboard

feat: [CLI] Insert DBGroup variable in CLI validate method

Open daycry opened this issue 10 months ago • 12 comments

Description Allow a different DBGroup to be added in CLI class validations.

Checklist:

  • [ ] Securely signed commits
  • [ ] Component(s) with PHPDoc blocks, only if necessary or adds value
  • [ ] Unit testing, with >80% coverage
  • [ ] User guide updated
  • [ ] Conforms to style guide

daycry avatar Apr 11 '24 08:04 daycry

Please sign all commits.

We ask that contributions have code commits signed. This is important in order to prove, as best we can, the provenance of contributions. See https://github.com/codeigniter4/CodeIgniter4/blob/develop/contributing/signing.md

kenjis avatar Apr 11 '24 09:04 kenjis

Add test code.

We expect all code changes or bug-fixes to be accompanied by one or more tests added to our test suite to prove the code works. https://github.com/codeigniter4/CodeIgniter4/blob/develop/contributing/pull_request.md#contributions

kenjis avatar Apr 11 '24 09:04 kenjis

@codeigniter4/core-team Is this a bug fix?

kenjis avatar Apr 11 '24 09:04 kenjis

This is a feature.

But I'm confused why CLI has to know the database group for prompts. It feels out of place here.

paulbalandan avatar Apr 11 '24 09:04 paulbalandan

I I'm doing the secure commit but it doesn't detect it

daycry avatar Apr 11 '24 10:04 daycry

@daycry What do you mean? What did you do exactly?

kenjis avatar Apr 11 '24 10:04 kenjis

@daycry

The email in this signature doesn’t match the committer email.

kenjis avatar Apr 11 '24 10:04 kenjis

@daycry Why do you need to add this?

kenjis avatar Apr 11 '24 10:04 kenjis

If you want validate rules with another database, you cant It, because now you cant pass DBGroup variable in prompt función.

On Thu, 11 Apr 2024, 12:12 kenjis, @.***> wrote:

@daycry https://github.com/daycry Why do you need to add this?

— Reply to this email directly, view it on GitHub https://github.com/codeigniter4/CodeIgniter4/pull/8762#issuecomment-2049364807, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABZ5DP34BQJNEUNMJPHI33TY4ZOZNAVCNFSM6AAAAABGB3Y6R6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANBZGM3DIOBQG4 . You are receiving this because you were mentioned.Message ID: @.***>

daycry avatar Apr 11 '24 11:04 daycry

@daycry Okay, but this is an enhancement. So please change the base branch to 4.6. See https://github.com/codeigniter4/CodeIgniter4/blob/develop/contributing/workflow.md#if-you-sent-to-the-wrong-branch

kenjis avatar Apr 11 '24 11:04 kenjis

@paulbalandan The database group is a part of the validation rules. But it cannot be set in the rule. After all, there seems no good other way to set it.

I have a feeling that it would be better to set up the following: is_unique[table.field,ignore_field,ignore_value,db_group] However, if we do so, we will not be able to pass a DB connection instance.

kenjis avatar Apr 11 '24 11:04 kenjis

I wan't pass DB connection instance, only DBGroup name, but I will try this.

is_unique[table.field,ignore_field,ignore_value,db_group]

Thanks

daycry avatar Apr 11 '24 11:04 daycry

[!IMPORTANT] We expect all code changes or bug-fixes to be accompanied by one or more tests added to our test suite to prove the code works.

This PR does not have the necessary test code. If you want this PR to be reviewed, please add the test code. See https://github.com/codeigniter4/CodeIgniter4/blob/develop/contributing/pull_request.md#unit-testing

If the test is not added, this PR will be closed.

kenjis avatar Aug 21 '24 09:08 kenjis