Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Uniqueness validation over compund field

I am trying to validate a compound field in the model, so I tried:

$this->validate(new Uniqueness(array(
   'field' => 'foreign_id, servers_id',
   'message' => 'The brand is already present on the selected server.'
)));

But Phalcon says:

Column 'foreignid, serversid' isn't part of the table columns

Any ideas ?



46.9k

compoun field

Do you mean a computed field?

Here is the Zephir code for the Uniqueness validator. Its not too difficult to read.



33.6k
Accepted
answer
$this->validate(new Uniqueness(array(
   'field' => ['foreign_id', 'servers_id'],
   'message' => 'The brand is already present on the selected server.'
)));

Thanks ! Works fine :)