public static function isValid(&$properties_dictionary, $limit_to_keys, &$error) { // Check each property is valid // if (!parent::isValid($properties_dictionary, $limit_to_keys, $error)) { return false; } // First name, surname, name // if (ValidationC::should_test_property(CREATINGUSER_KEY_FIRST_NAME, $properties_dictionary, true, $limit_to_keys) && !CreatingUser::propertyIsValid(CREATINGUSER_KEY_FIRST_NAME, $properties_dictionary[CREATINGUSER_KEY_FIRST_NAME], $error)) { return false; } if (ValidationC::should_test_property(CREATINGUSER_KEY_SURNAME, $properties_dictionary, true, $limit_to_keys) && !CreatingUser::propertyIsValid(CREATINGUSER_KEY_SURNAME, $properties_dictionary[CREATINGUSER_KEY_SURNAME], $error)) { return false; } if (ValidationC::should_test_property(CREATINGUSER_KEY_NAME, $properties_dictionary, true, $limit_to_keys) && !CreatingUser::propertyIsValid(CREATINGUSER_KEY_NAME, $properties_dictionary[CREATINGUSER_KEY_NAME], $error)) { return false; } if (ValidationC::should_test_property(CREATINGUSER_KEY_GENDER, $properties_dictionary, true, $limit_to_keys) && !CreatingUser::propertyIsValid(CREATINGUSER_KEY_GENDER, $properties_dictionary[CREATINGUSER_KEY_GENDER], $error)) { return false; } $should_test_all_names = ValidationC::should_test_property(CREATINGUSER_KEY_FIRST_NAME, $properties_dictionary, true, $limit_to_keys) && ValidationC::should_test_property(CREATINGUSER_KEY_SURNAME, $properties_dictionary, true, $limit_to_keys) && ValidationC::should_test_property(CREATINGUSER_KEY_NAME, $properties_dictionary, true, $limit_to_keys); if ($should_test_all_names && (empty($properties_dictionary[CREATINGUSER_KEY_FIRST_NAME]) || isset($properties_dictionary[CREATINGUSER_KEY_SURNAME])) && isset($properties_dictionary[CREATINGUSER_KEY_NAME])) { // Set either first name and surname, or, just a name // $error = Error::withDomain(VALIDATION_ERROR_DOMAIN, VALIDATION_ERROR_CODE_INVALID_PROPERTY, 'When setting a name, set either ' . CREATINGUSER_KEY_FIRST_NAME . ' and ' . CREATINGUSER_KEY_SURNAME . ', or, just a ' . CREATINGUSER_KEY_NAME . '.'); return false; } return true; }
public static function propertyIsValid($property_name, &$property_value, &$error) { return parent::propertyIsValid($property_name, $property_value, $error); }