Skip to content
New issue

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

CodeIgniter\Model::cleanValidationRules() must be of the type array, string given #1707

Closed
niteraven7 opened this issue Feb 7, 2019 · 2 comments

Comments

@niteraven7
Copy link

Validating data from form post with a rule set by name via controller, e.g:

$this->validate('account')

Throws this error:
Argument 1 passed to CodeIgniter\Model::cleanValidationRules() must be of the type array, string given, framework\system\Model.php on line 1259

This worked fine since alpha3... not working in alpha5.

@niteraven7
Copy link
Author

Actually after a bit of further testing and digging- it does not appear to matter if the rule set is a name or array... the error stems from this line in the model:

protected $validationRules = 'account';

If I comment that out it works fine?

@niteraven7
Copy link
Author

After even further digging- it appears this works:

protected $validationRules = ['account'];

From docs:
Contains either an array of validation rules as described in How to save your rules or a string containing the name of a validation group, as described in the same section. Described in more detail below.

I guess the array is new but it still states that a string will work?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant