Skip to content

Commit d6cc324

Browse files
committed
added docs for modId functionality
1 parent 0a7519a commit d6cc324

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

README.md

+25-1
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,28 @@ protected $dateFormat = 'n/j/Y g:i:s A'; // 7/1/1920 4:01:01 PM
237237
protected $dateFormat = 'n/j/Y G:i:s'; // 7/1/1920 16:01:01
238238
```
239239

240+
### Modification ID (modId)
241+
242+
The Data API lets you set a [Modification ID](https://help.claris.com/en/data-api-guide/content/edit-record.html) when editing records.
243+
244+
> Specifying a modification ID ensures that you are editing the current version of a record. If the modification ID value does not match the current modification ID value in the database, the record is not changed.
245+
246+
If you wish to include the modId when editing a record you can call `withModId()` before calling `save()` on the model object. This will send the ModID to FileMaker when updating the record, and will throw a `FileMakerDataApiException` if the ModId does not match.
247+
248+
```php
249+
$person->withModId()->save();
250+
```
251+
252+
The modId is automatically set on the model object when you retrieve a record from FileMaker, so you don't need to set it manually.
253+
254+
255+
If you always want the ModId to be included when saving a record, you can set the `$withModId` property to true on your model class.
256+
257+
```php
258+
protected $useModId = true;
259+
```
260+
261+
If you wish to always include a ModId on a model, you can set `protected $withModId = true;` on your model class.
240262

241263
## Example FMModel Class
242264
```php
@@ -314,7 +336,8 @@ FM::setGlobalFields() // not chainable
314336
->portalLimit( $portalName, $limit )
315337
->portalOffset( $portalName, $startingRecord )
316338
->sort() // alias for the native orderBy()
317-
->omit()
339+
->omit() // change the request to an "omit" request
340+
->modId( string $modId ) // set the modId to submit when editing a record
318341
->fieldData( $array )
319342
->portalData( $array )
320343
```
@@ -367,6 +390,7 @@ $json = json_encode ([
367390
$result = FM::layout('globals')->performScript('New Contact Request'; $json);
368391
```
369392

393+
370394
Perform a script on a database other than the default database connection
371395
```php
372396
$result = FM::connection('MyOtherDatabaseConnectionName')->layout('MyLayoutName')->performScript('MyScriptName');

0 commit comments

Comments
 (0)