We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Uniqueness - Fields in failed message

Hi,

I'm using Phalcon\Validation\Validator\Uniqueness and I have the following rule for categories and accounts:

$validation->add(['name', 'accountId'], new Uniqueness([
    'label' => 'category'
]));

I would like to know if it is possible to change the field returned by the Phalcon\Validation\Message object to "name", because "accountId" is controlled internally by the application.



145.0k
Accepted
answer

Actually not sure if this is possible and also i had this issue sometimes also that returned field name is kinf of bad, can you open NFR at github?

I think it is not a problem, but an atypical case. My business rule works differently. Sure I can. Thanks for the answer.

Actually not sure if this is possible and also i had this issue sometimes also that returned field name is kinf of bad, can you open NFR at github?