Download the PHP package stwarog/uow-fuel without Composer
On this page you can find all versions of the php package stwarog/uow-fuel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download stwarog/uow-fuel
More information about stwarog/uow-fuel
Files in stwarog/uow-fuel
Package uow-fuel
Short Description Unit of Work feature for Fuel's PHP ORM.
License MIT
Informations about the package uow-fuel
Fuel PHP ORM's Unit of Work Layer
Foreword
This package is an extension for UOW Core for Fuel PHP Framework. At this moment it supports ORM models (with relations).
Zero configuration installation
Just find some place to initialize this package (wrap it to the singleton or use dependency injection container), then call:
DB must be a reference to your instance of this class (it is globally available in Fuel). UOW Core will use existing (and configured) object to build queries based on resolved criteria.
Take a look at configuration guide to change default behaviour of package.
The problem & Goal
Fuel's ORM is convenient in use. We can use OOP syntax to handle relations, batch update etc.
Assuming we have Todo
model with many Lines
, let's compare result of test below:
Fuel's way
but the problem is that the Fuel will produce for example (writing part):
In case we have much more related lines it might be a huge performance hit.
"Unit of Work" approach
Let's refactor code above to this plugin syntax:
Script will group changed table columns & fields and built query in more elegant way! All will be wrapped in transaction out of the box.
Of course these examples are trivial. In real life each model may have a lots of nested relations. Entity Manager will take care how final query should looks like.
Contribution
Please take a look at core contribution guide.
License
MIT
Change Log
1.4.0 (2021-07-21)
- Upgraded core package to 1.4.0
- Implemented no longer new in FuelModelAdapter.php
- Unit tests configuration + pseudo Mock of Fuel`s ORM
1.3.1 (2021-07-10)
- Upgraded core package to 1.3.1
1.3.0 (2021-06-23)
- Upgraded core package to 1.3.0
- Reduced phpstan errors to 2
1.2.0 (2021-06-21)
- upgraded core package to 1.2.0
- added ./tests to .gitignore
- installed & configured PHPCS, PHPSTAN
1.1.3 (2021-01-04)
- 398d1247 used the most recent version of uow core
1.1.2 (2021-01-03)
- a0bf93b7 used array_diff_assoc instead of array_diff due no columns were checked
All versions of uow-fuel with dependencies
fuel/core Version ^1.8 | dev-1.9/develop
fuel/orm Version ^1.8 | dev-1.9/develop
stwarog/uow Version ^2.0.0