Example #1
0
 /**
  *
  * @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;
 }
Example #2
0
 /**
  * Loads extended (FMPXMLLAYOUT) layout information.
  *
  * @access private
  *
  * @return boolean|FileMakerException TRUE, if successful.
  * @throws FileMakerException
  */
 public function loadExtendedInfo()
 {
     $error = new FileMakerException($this->fm, 'Related sets do not support extended information.');
     if ($this->fm->getProperty('errorHandling') === 'default') {
         return $error;
     }
     throw $error;
 }
Example #3
0
 /**
  * Loads extended (FMPXMLLAYOUT) layout information.
  *
  * @access private
  *
  * @param string  $recid Record from which to load extended information.
  *
  * @return boolean TRUE, if successful.
  * @throws FileMakerException;
  */
 public function loadExtendedInfo($recid = null)
 {
     if (!$this->extended || $recid != null) {
         if ($recid != null) {
             $result = $this->fm->execute(array('-db' => $this->fm->getProperty('database'), '-lay' => $this->getName(), '-recid' => $recid, '-view' => null), 'FMPXMLLAYOUT');
         } else {
             $result = $this->fm->execute(array('-db' => $this->fm->getProperty('database'), '-lay' => $this->getName(), '-view' => null), 'FMPXMLLAYOUT');
         }
         $parser = new FMPXMLLAYOUT($this->fm);
         $parseResult = $parser->parse($result);
         if (FileMaker::isError($parseResult)) {
             return $parseResult;
         }
         $parser->setExtendedInfo($this);
         $this->extended = true;
     }
     return $this->extended;
 }
Example #4
0
 protected function _getCommandParams()
 {
     $queryParams = array('-db' => $this->fm->getProperty('database'), '-lay' => $this->_layout);
     foreach (array('_script' => '-script', '_preReqScript' => '-script.prefind', '_preSortScript' => '-script.presort') as $varName => $paramName) {
         if ($this->{$varName}) {
             $queryParams[$paramName] = $this->{$varName};
             $varName .= 'Params';
             if ($this->{$varName} !== null) {
                 $queryParams[$paramName . '.param'] = $this->{$varName};
             }
         }
     }
     if ($this->_resultLayout) {
         $queryParams['-lay.response'] = $this->_resultLayout;
     }
     foreach ($this->_globals as $fieldName => $fieldValue) {
         $queryParams[$fieldName . '.global'] = $fieldValue;
     }
     return $queryParams;
 }