$this->id, 'module' => $this->module, 'action' => $this->action, 'field_id' => $this->fieldId, 'error_message' => $this->errorMessage, 'type' => $this->type, 'min_length' => $this->minLength, 'max_length' => $this->maxLength, 'mandatory' => $this->mandatory, 'comparator' => $this->comparator, 'compareto' => $this->compareto, ]; } /** * @param array $data * * @return MandatoryFieldData */ public static function fromDbState(array $data): MandatoryFieldData { $mandatoryField = new MandatoryFieldData(); $mandatoryField->module = $data['module']; $mandatoryField->action = $data['action']; $mandatoryField->fieldId = $data['field_id']; $mandatoryField->type = $data['type']; if (isset($data['id'])) { $mandatoryField->id = (int)$data['id']; } if (isset($data['error_message'])) { $mandatoryField->errorMessage = $data['error_message']; } if (isset($data['min_length'])) { $mandatoryField->minLength = (int)$data['min_length']; } if (isset($data['max_length'])) { $mandatoryField->maxLength = (int)$data['max_length']; } if (isset($data['mandatory'])) { $mandatoryField->mandatory = (bool)$data['mandatory']; } if (isset($data['comparator'])) { $mandatoryField->comparator = $data['comparator']; } if (isset($data['compareto'])) { $mandatoryField->compareto = str_replace(',', '.', $data['compareto']); } return $mandatoryField; } /** * @return int */ public function getId(): int { return $this->id; } /** * @return string */ public function getModule(): string { return $this->module; } /** * @return string */ public function getAction(): string { return $this->action; } /** * @return string */ public function getFieldId(): string { return $this->fieldId; } /** * @return string */ public function getErrorMessage(): string { return $this->errorMessage; } /** * @return string */ public function getType(): string { return $this->type; } /** * @return int */ public function getMinLength(): int { return $this->minLength; } /** * @return int */ public function getMaxLength(): int { return $this->maxLength; } /** * @return bool */ public function isMandatory(): bool { return $this->mandatory; } /** * @return string */ public function getComparator(): string { return $this->comparator; } /** * @return string */ public function getCompareto(): string { return $this->compareto; } }