Created
October 8, 2014 18:12
-
-
Save mraspor/b1fd651bda969451b905 to your computer and use it in GitHub Desktop.
Modified Message class extends from Phalcon\Validation\Message to enable translation.Translation service needs to be set in DI. Don't forget to add correct namespace to your $loader.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Library\Validation; | |
use Phalcon\DI; | |
/** | |
* Class Message | |
* | |
* This is a modification of the default Validation/Message class | |
* Modified to return a translated message | |
* | |
* User: mraspor | |
* Date: 10/8/14 | |
* Time: 5:00 PM | |
* | |
* @package Library\Validation | |
*/ | |
class Message extends \Phalcon\Validation\Message { | |
/** | |
* @return mixed | |
*/ | |
public function getMessage() | |
{ | |
$di = DI::getDefault(); | |
return $di->get('translation')->_($this->_message); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment