{"action":"opened","issue":{"url":"https://api.github.com/repos/phalcon/cphalcon/issues/12296","repository_url":"https://api.github.com/repos/phalcon/cphalcon","labels_url":"https://api.github.com/repos/phalcon/cphalcon/issues/12296/labels{/name}","comments_url":"https://api.github.com/repos/phalcon/cphalcon/issues/12296/comments","events_url":"https://api.github.com/repos/phalcon/cphalcon/issues/12296/events","html_url":"https://github.com/phalcon/cphalcon/issues/12296","id":181519479,"number":12296,"title":"Phalcon\\Mvc\\Model::validate() must implement interface bug","user":{"login":"dercoder","id":1737685,"avatar_url":"https://avatars.githubusercontent.com/u/1737685?v=3","gravatar_id":"","url":"https://api.github.com/users/dercoder","html_url":"https://github.com/dercoder","followers_url":"https://api.github.com/users/dercoder/followers","following_url":"https://api.github.com/users/dercoder/following{/other_user}","gists_url":"https://api.github.com/users/dercoder/gists{/gist_id}","starred_url":"https://api.github.com/users/dercoder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dercoder/subscriptions","organizations_url":"https://api.github.com/users/dercoder/orgs","repos_url":"https://api.github.com/users/dercoder/repos","events_url":"https://api.github.com/users/dercoder/events{/privacy}","received_events_url":"https://api.github.com/users/dercoder/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-10-06T20:39:02Z","updated_at":"2016-10-06T20:39:02Z","closed_at":null,"body":"I am trying to use model validation like here:\r\nhttps://docs.phalconphp.com/en/latest/api/Phalcon_Mvc_Model_Validator_Uniqueness.html\r\n\r\nCode:\r\n```php\r\n<?php\r\n\r\nnamespace Models;\r\n\r\nuse Phalcon\\Mvc\\Model;\r\nuse Phalcon\\Mvc\\Model\\Validator\\Uniqueness;\r\n\r\nclass Subscriptors extends Model\r\n{\r\n\r\n    public function validation()\r\n    {\r\n        $this->validate(new Uniqueness(array(\r\n            \"field\"   => \"email\",\r\n            \"message\" => \"Value of field 'email' is already present in another record\"\r\n        )));\r\n        if ($this->validationHasFailed() == true) {\r\n            return false;\r\n        }\r\n    }\r\n}\r\n```\r\n\r\nThis is the error message:\r\n```\r\nTypeError: Argument 1 passed to Phalcon\\Mvc\\Model::validate() must implement interface Phalcon\\ValidationInterface, instance of Phalcon\\Mvc\\Model\\Validator\\Uniqueness given\r\n/app/models/Subscriptors.php (14)\r\n```\r\n\r\n* Phalcon version: 3.0.1\r\n* PHP Version: 7.0.11\r\n* Installation type: Compiling from source\r\n"}}
{"actor":{"display_login":"dercoder"}}