Entity setError on compound fieldName


I have this $this->Form->control() items:


when I submit form, it is show as array on entity, but I need to set a error to one of this fields.

I tried:

$this->setError(‘number_of_frames_by_size.A1’, ‘message’);
$this->setError(‘number_of_frames_by_size_A1’, ‘message’);
$this->setError(‘number_of_frames_by_size[A1]’, ‘message’);

none worked


In an entity setError() should be the method to use. Have you made sure that your form is using the entity as its ‘data source’? You would do this with $this->Form->create($entity). If you don’t do that the FormHelper doesn’t know about the entity and can’t read validation errors from it.