Bug Report #4429
_external array for Validation loads the incorrect file
| Status: | Closed | Start date: | 08/06/2011 | |
|---|---|---|---|---|
| Priority: | High | Due date: | ||
| Assignee: | % Done: | 100% |
||
| Category: | - | |||
| Target version: | Kohana v3.x - v3.3.0 | |||
| Resolution: | fixed | Points: | 1 |
Description
Test platform:
- Ubuntu 11.04
- PHP 5.3.5
- Apache 2.2.17
This error surfaces when using external validation with ORM:
$external_validation = Validation::factory($this->request->post())
->rule('password', 'not_empty');
try
{
$user = ORM::factory('user', 5);
$user
->values($this->request->post())
->update($external_validation);
}
catch (ORM_Validation_Exception $e)
{
$errors = $e->errors('models');
}
When, errors are thrown, all the messages which apply to rules set in the model are getting loaded from the correct file (messages/models/user). External validations however, should get the errors from messages/models/user/_external.php. This doesn't happen and the ORM_Validation_Exception class instead loads the standard message.
The problem is found on line 165 of Kohana_ORM_Validation_Exception:
$file = trim($directory.'/'.$alias.'/', '/');
Which will be set to messages/models/_external.php instead of messages/models/user/_external.php
Related issues
History
Updated by Lorenzo Pisani 3 months ago
fixed by this merge: https://github.com/kohana/orm/commit/075cb722fedc0333fa2a7dc746bc72abaca85db9