/** * Returns a Field object that describes the specified field. * * @param string $fieldName Name of field. * * @return Field|FileMakerException Field object, if successful. * @throws FileMakerException */ public function getField($fieldName) { if (isset($this->fields[$fieldName])) { return $this->fields[$fieldName]; } $error = new FileMakerException($this->fm, 'Field ' . $fieldName . ' Not Found in Layout ' . $this->layout->getName()); if ($this->fm->getProperty('errorHandling') === 'default') { return $error; } throw $error; }
/** * * @return boolean|FileMakerException TRUE on success * @throws FileMakerException */ private function _commitEditChild() { $modifiedFields = []; foreach ($this->fields as $fieldName => $repetitions) { foreach ($repetitions as $repetition => $value) { if (!empty($this->_modifiedFields[$fieldName][$repetition])) { $modifiedFields[$fieldName . '.' . $this->recordId][$repetition] = $value; } } } $editCommand = $this->fm->newEditCommand($this->parent->layout->getName(), $this->parent->getRecordId(), $modifiedFields); $result = $editCommand->execute(); if (FileMaker::isError($result)) { return $result; } $records = $result->getRecords(); $firstRecord = $records[0]; $relatedSet = $firstRecord->getRelatedSet($this->layout->getName()); if (FileMaker::isError($relatedSet)) { return $relatedSet; } foreach ($relatedSet as $record) { if ($record->getRecordId() == $this->recordId) { return $this->_updateFrom($record); break; } } $error = new FileMakerException($this->fm, 'Failed to find the updated child in the response.'); if ($this->fm->getProperty('errorHandling') === 'default') { return $error; } throw $error; }