/** * @param CM_FormField_Abstract $field * @throws CM_Exception_Invalid */ protected function registerField(CM_FormField_Abstract $field) { $fieldName = $field->getName(); if ($this->hasField($fieldName)) { throw new CM_Exception_Invalid('Form field is already registered.', null, ['fieldName' => $fieldName]); } $this->_fields[$fieldName] = $field; }
/** * @param CM_FormField_Abstract $field * @throws CM_Exception_Invalid */ protected function registerField(CM_FormField_Abstract $field) { $fieldName = $field->getName(); if (isset($this->_fields[$fieldName])) { throw new CM_Exception_Invalid('Form field `' . $fieldName . '` is already registered.'); } $this->_fields[$fieldName] = $field; }