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');
$this->add($field);
$field = new Select('bundle_id', $this->bundleRepository->find(), ['using' => ['id', 'name']]);
$this->add($field);
}
}
After execution some weird error occurs in log:
Parameter 'name' must be a string
Anbody had similar problem? Any sugestion will by nice!