Use ModelValidator::count() to count dynamiclly added validation rules

This commit is contained in:
David Gallagher 2013-07-26 22:44:59 +10:00
parent 8b21710c95
commit 5937685817

View file

@ -218,7 +218,7 @@ class FormHelper extends AppHelper {
if ($key === 'validates' && !isset($this->fieldset[$model]['validates'])) {
$validates = array();
if (!empty($object->validate)) {
if ($object->validator()->count() > 0) {
foreach ($object->validator() as $validateField => $validateProperties) {
if ($this->_isRequiredField($validateProperties)) {
$validates[$validateField] = true;