https://github.com/cycle/entity-behavior
https://github.com/cycle/entity-behavior
hacktoberfest
Last synced: 10 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/cycle/entity-behavior
- Owner: cycle
- License: mit
- Created: 2021-10-05T19:37:59.000Z (over 4 years ago)
- Default Branch: 1.x
- Last Pushed: 2024-08-09T11:47:51.000Z (almost 2 years ago)
- Last Synced: 2024-12-13T21:49:49.465Z (over 1 year ago)
- Topics: hacktoberfest
- Language: PHP
- Homepage:
- Size: 130 KB
- Stars: 9
- Watchers: 4
- Forks: 6
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Cycle ORM Entity Behavior
[](https://packagist.org/packages/cycle/entity-behavior)
[](https://github.com/cycle/entity-behavior/actions)
[](https://scrutinizer-ci.com/g/cycle/entity-behavior/?branch=1.x)
[](https://codecov.io/gh/cycle/entity-behavior)

The package provides a collection of attributes that add behaviors to Cycle ORM entities. It also provides a convenient
API to create custom behavior attributes.
## Installation
The package is available via composer and can be installed using the following command:
```bash
composer require cycle/entity-behavior
```
## Configuration
After installation the package you need to create `Cycle\ORM\ORM` object with
passing `\Cycle\ORM\Entity\Behavior\EventDrivenCommandGenerator` generator object as third (`commandGenerator`)
argument.
**Example**
```php
use Cycle\ORM\ORM;
use Cycle\ORM\Entity\Behavior\EventDrivenCommandGenerator;
// Application container (PSR-11 compatible).
// https://www.php-fig.org/psr/psr-11/
$container = new Container();
$commandGenerator = new EventDrivenCommandGenerator($schema, $container);
$orm = new ORM(
factory: $factory,
schema: $schema,
commandGenerator: $commandGenerator,
);
```
That's it. Now you can use all benefits of this package.
### Available behaviors
- [UUID](https://cycle-orm.dev/docs/entity-behaviors-uuid)
- [CreatedAt and UpdatedAt](https://cycle-orm.dev/docs/entity-behaviors-timestamps)
- [SoftDelete](https://cycle-orm.dev/docs/entity-behaviors-soft-delete)
- [OptimisticLock](https://cycle-orm.dev/docs/entity-behaviors-optimistic-lock)
- [Hook](https://cycle-orm.dev/docs/entity-behaviors-hooks)
- [EventListener](https://cycle-orm.dev/docs/entity-behaviors-event-listener)
## License:
The MIT License (MIT). Please see [`LICENSE`](./LICENSE) for more information. Maintained
by [Spiral Scout](https://spiralscout.com).