function checkRequiredFields(&$nvps) { $requiredFields =& $this->getRequiredFields(); if (!empty($requiredFields)) { $values = array(); foreach ($nvps as $name => $value) { $canonicalName = BeanWrapperUtils::canonicalPropertyName($name); $values[$canonicalName] = $value; } foreach ($requiredFields as $field) { $value = isset($values[$field]) ? $values[$field] : null; if ($value == null || is_string($value) && trim($value) == "") { $bep =& $this->getBindingErrorProcessor(); $bep->processMissingFieldError($field, $this->_getInternalBindingResult()); unset($nvps[$field]); unset($values[$field]); } } } }
/** * Determine the canonical field name for the given field. * <p>The default implementation simply returns the field name as-is. * @param field the original field name * @return the canonical field name */ function _canonicalFieldName($field) { return BeanWrapperUtils::canonicalPropertyName($field); }
/** * Determine the canonical names for the given property paths. * * @param array $propertyNames the bean property paths (as array) * @return array the canonical representation of the property paths * (as array of the same size) * @see canonicalPropertyName */ function &canonicalPropertyNames($propertyNames) { if ($propertyNames == null) { return null; } $result = array(); for ($i = 0; $i < count($propertyNames); $i++) { $result[$i] =& BeanWrapperUtils::canonicalPropertyName($propertyNames[$i]); } return $result; }