CodeIgniter4 icon indicating copy to clipboard operation
CodeIgniter4 copied to clipboard

fix: do not use ValidationInterface

Open kenjis opened this issue 3 years ago • 5 comments

Description Fixes #6224

BaseModel uses the 3rd param of $this->validation->run($data, null, $this->DBGroup). So it depends on Validation, not ValidationInterface.

Ref: https://github.com/codeigniter4/CodeIgniter4/pull/5909#issuecomment-1179518692

Checklist:

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

kenjis avatar Jul 10 '22 01:07 kenjis

Let's see where the big PR takes this conversation. I'm fine with this one following from that - I do think that this is pretty likely to break some projects and libraries since Model constructors are likely to be extended.

MGatner avatar Jul 10 '22 11:07 MGatner

If we can change the ValidationInterface, we have an option to change it instead.

kenjis avatar Jul 11 '22 04:07 kenjis

You know that's not a bad idea. If I had to guess I would say there are probably more developers extending Model::__construct() than making their own Validation driver (since the driver can be "extended" via rules already).

MGatner avatar Jul 11 '22 10:07 MGatner

there are probably more developers extending Model::__construct() than making their own Validation driver

I agree. I guess so. It seems changing ValidationInterface makes less apps break.

kenjis avatar Jul 11 '22 21:07 kenjis

I sent another PR #6253

kenjis avatar Jul 11 '22 23:07 kenjis

#6253 was merged.

kenjis avatar Sep 07 '22 22:09 kenjis