We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

Validation uniqueness of multiple fields in form class

Hi, i trying validate uniqueness multiple field in form class. I based on https://forum.phalcon.io/discussion/15851/using-uniqueness-validation-in-forms-with-multiple-fields-and-sp but i failed.

I make that code, but i can't find where's problem:

use Phalcon\Validation\Validator\Uniqueness as UniquenessValidator;

class BundleUserForm extends Form
    public function getValidation()
        $validator = new Validation();
        $validator->add(['quantity', 'bundle_id'], new UniquenessValidator([
            'model' => $this->getEntity()
        return $validator;

    public function build()
        $field = new Numeric('quantity');

        $field = new Select('bundle_id', $this->bundleRepository->find(), ['using' => ['id', 'name']]);

After execution some weird error occurs in log:

Parameter 'name' must be a string

Anbody had similar problem? Any sugestion will by nice!

edited Apr '18

What exactly is entity? Maybe in database you have not null column and you forgot to set it anyway? Or try to cleat metadata. This is built-in not-null validation based on null/not null columns in database.