class MyForm extends \Phalcon\Forms\Form
{
public function initialize() {
$this->setEntity($this);
$slug = new Text('slug');
$slug->setFilters(array('striptags', 'trim'));
$slug->addValidator( new UniquenessValidator(array(
'model' => '\MyModel\Post',
'message' => 'slug exist!'
)));
$this->add($slug);
}
}
When make validation, it throws the below error:
Trying to call method getdi on a non-object
#0 [internal function]: Phalcon\Validation\Validator\Uniqueness->getColumnNameReal('\\MyModel\\P...', 'slug')
#1 [internal function]: Phalcon\Validation\Validator\Uniqueness->isUniqueness(Object(Phalcon\Validation), 'slug')
#2 [internal function]: Phalcon\Validation\Validator\Uniqueness->validate(Object(Phalcon\Validation), 'slug')
#3 [internal function]: Phalcon\Validation->validate(Array, NULL)
#4 ...MyController.php(62): Phalcon\Forms\Form->isValid(Array)
#5 [internal function]: ...
#6 [internal function]: Phalcon\Dispatcher->dispatch()
#7 ...Phalcon\Mvc\Application->handle()
#8 {main}