Skip to content
Snippets Groups Projects
Verified Commit e64f4c6f authored by Jiří Pudil's avatar Jiří Pudil
Browse files

update docs

parent 8228b59f
No related branches found
No related tags found
1 merge request!50more robust creation/modification API
Pipeline #53331 passed with warnings
......@@ -292,16 +292,16 @@ $changeSet = $table->new(
);
```
The method returns a change set which you can further modify, and eventually save:
The method returns a change set which you can further modify, and eventually insert:
```php
$changeSet->modifyText('Post text');
$table->save($changeSet);
$table->insert($changeSet);
```
### Update
To update a record in the table, first you need to get an instance of change set for the specific record. You can get one for any given primary key or row:
To update a record in the table, you need to get an instance of change set for the specific record. You can get one for any given primary key or row:
```php
$changeSet = $table->edit(ArticlePrimaryKey::from($articleId));
......@@ -309,11 +309,20 @@ $changeSet = $table->edit(ArticlePrimaryKey::from($articleId));
$changeSet = $table->edit($articleRow);
```
Then you can add modifications to the change set and finally save it:
You can use named parameters to provide the values to update right within the method call:
```php
$changeSet = $table->edit(
$articleRow,
deletedAt: \Brick\DateTime\Instant::now(),
);
```
As before, you can also add modifications to the change set afterward, and finally save it:
```php
$changeSet->modifyDeletedAt(\Brick\DateTime\Instant::now());
$table->save($changeSet);
$table->update($changeSet);
```
### Delete
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment