protected function isEmpty($value) { if (is_array($value)) { $filtered = array_filter($value); return empty($filtered); } return parent::isEmpty($value); }
/** * Returns true if the value is empty. * * @param mixed $value The input value * * @return bool true if the value is empty, false otherwise */ protected function isEmpty($value) { if (parent::isEmpty($value)) { return true; } if (is_array($value)) { $isEmpty = true; foreach ($value as $v) { if (!parent::isEmpty($v)) { $isEmpty = false; break; } } return $isEmpty; } return false; }
/** * @see sfValidatorBase */ protected function isEmpty($value) { if (is_array($value)) { // array is not empty when a value is found foreach ($value as $key => $val) { // int and string '0' are 'empty' values that are explicitly accepted if ($val === 0 || $val === '0' || !empty($val)) { return false; } } return true; } return parent::isEmpty($value); }