Skip to content

Commit

Permalink
Document rollbackCode() and completionCode().
Browse files Browse the repository at this point in the history
  • Loading branch information
greg-1-anderson committed Mar 16, 2017
1 parent 2bbcdad commit 5d806c2
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions docs/collections.md
Expand Up @@ -113,6 +113,17 @@ Any task may also implement \Robo\Contract\RollbackInterface; if this is done, t

Use `addAsCompletion($collection)` in place of `addAsRollback($collection)`, or implement \Robo\Contract\CompletionInterface. Completions otherwise work exactly like rollbacks.

### Rollback and Completion Callbacks

You may also provide arbitrary methods as `callable`s to serve as rollback or completion functions, as shown below:

``` php
<?php
$collection->rollbackCode([$myobject, 'myrollback']);
$collection->completionCode([$myobject, 'mycompletion']);
?>
```

## Temporary Objects

Since the concept of temporary objects that are cleaned up on failure is a common pattern, Robo provides built-in support for them. Temporary directories and files are provided out of the box; other kinds of temporary objects can be easily created using the Temporary global collection.
Expand Down

0 comments on commit 5d806c2

Please sign in to comment.