PHPackages                             icanboogie/operation - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. icanboogie/operation

ActiveLibrary[Framework](/categories/framework)

icanboogie/operation
====================

Feature rich controllers dedicated to a single task

5.0(5y ago)03.4k3BSD-3-ClausePHPPHP &gt;=7.2CI failing

Since Oct 24Pushed 5y ago1 watchersCompare

[ Source](https://github.com/ICanBoogie/Operation)[ Packagist](https://packagist.org/packages/icanboogie/operation)[ Docs](https://icanboogie.org/)[ RSS](/packages/icanboogie-operation/feed)WikiDiscussions master Synced today

READMEChangelog (3)Dependencies (5)Versions (11)Used By (3)

Operation
=========

[](#operation)

[![Release](https://camo.githubusercontent.com/cf15a05c875461a7e66de9dff645bdca120ef7dbdcc3e14b839e3a75a663599b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6963616e626f6f6769652f6f7065726174696f6e2e737667)](https://packagist.org/packages/icanboogie/operation)[![Build Status](https://camo.githubusercontent.com/52a4b2f53e2aa9bc6c2e765b20edc41d5dd15193aa248c702b0793e66b849d16/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f4943616e426f6f6769652f4f7065726174696f6e2f74657374)](https://github.com/ICanBoogie/Operation/actions?query=workflow%3Atest)[![Code Quality](https://camo.githubusercontent.com/f4e53defcd0d1d688b4101d9ba569ddb662cb9b1d824f42f51382133aa2abb7a/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f4943616e426f6f6769652f4f7065726174696f6e2e737667)](https://scrutinizer-ci.com/g/ICanBoogie/Operation)[![Code Coverage](https://camo.githubusercontent.com/0ff5e383138f1d99962ed56e7b49a010248e07fc504d7d7d9008a096ffadad4f/68747470733a2f2f696d672e736869656c64732e696f2f636f766572616c6c732f4943616e426f6f6769652f4f7065726174696f6e2e737667)](https://coveralls.io/r/ICanBoogie/Operation)[![Packagist](https://camo.githubusercontent.com/2fb6b602a907f348a98373dce19c853e26230124b8a7055c5089f4e24f008126/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6963616e626f6f6769652f6f7065726174696f6e2e737667)](https://packagist.org/packages/icanboogie/operation)

Operations are feature rich controllers dedicated to a single task, which often is to create/update/delete records.

### Preamble

[](#preamble)

Events in this document are often referenced as `ICanBoogie\Operation::`, where `` is the type of the event. For instance, `ICanBoogie\Operation::rescue` is an event of type `rescue`, fired on an instance of `ICanBoogie\Operation`. Now consider a `SaveOperation`class inheriting from `ICanBoogie\Operation`. The `rescue` event could also be fired on one of its instances, and an event hook could be attached to `SaveOperation::rescue` to rescue the operation.

Because ICanBoogie's event system is based on class hierarchy an event hook attached to `SaveOperation::rescue` is only invoked to rescue instances of `SaveOperation` and its subclasses, whereas an event hook attached to `ICanBoogie\Operation::rescue` is invoked to rescue instances of `ICanBoogie\Operation` and its subclasses, including `SaveOperation`.

Thus, when you see `ICanBoogie\Operation::rescue` read *"the event type 'rescue' fired on an instance of the ICanBoogie\\Operation subclass I want to listen to"*.

Please read the documentation of the [icanboogie/event](https://github.com/ICanBoogie/Event) package for more details about the event system.

Operation
---------

[](#operation-1)

An instance of [Operation](https://icanboogie.org/api/operation/master/class-ICanBoogie.Operation.html) represents an operation. Although the class provides many control methods and getters, the validation and processing of the operation must be implemented by subclasses, according to their design.

### Controlling the operation

[](#controlling-the-operation)

Before the operation can be validated and processed, controls are ran. The controls to run are defined by the operation. The following controls are implemented and can be extended:

- `CONTROL_AUTHENTICATION`: Controls the authentication of the user.
- `CONTROL_PERMISSION`: Controls the permission of the user regarding the operation.
- `CONTROL_RECORD`: Controls the record associated with the operation. The getter `record` is used to retrieve the record.
- `CONTROL_OWNERSHIP`: Controls the ownership of the record by the user.
- `CONTROL_FORM`: Controls the form associated with the operation. The getter `form` is used to retrieve the form. [FormNotFound](https://icanboogie.org/api/operation/master/class-ICanBoogie.Operation.FormNotFound.html) can be thrown if the form associated with the operation cannot be found. [FormHasExpired](https://icanboogie.org/api/operation/master/class-ICanBoogie.Operation.FormHasExpired.html) can be thrown to indicate that the form associated with the operation has expired.

The controls definition is obtained though the `controls` magic property:

```
