for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Cycle\ORM;
use Cycle\ORM\Transaction\RunnerInterface;
use Cycle\ORM\Transaction\UnitOfWork;
/**
* Transaction provides ability to define set of entities to be stored or deleted within one transaction. Transaction
* can operate as UnitOfWork. Multiple transactions can co-exists in one application.
*
* Internally, upon "run", transaction will request mappers to generate graph of linked commands to create, update or
* delete entities.
* @deprecated since 2.0 use {@see \Cycle\ORM\EntityManager}
*/
final class Transaction implements TransactionInterface
Cycle\ORM\TransactionInterface
If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated annotation
ignore-deprecated
final class Transaction implements /** @scrutinizer ignore-deprecated */ TransactionInterface
This interface has been deprecated. The supplier of the interface has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the interface will be removed and what other interface to use instead.
{
private ?UnitOfWork $uow = null;
public function __construct(
private ORMInterface $orm,
private ?RunnerInterface $runner = null
) {
}
public function persist(object $entity, int $mode = self::MODE_CASCADE): self
$this->initUow()->persistDeferred($entity, $mode === self::MODE_CASCADE);
return $this;
public function delete(object $entity, int $mode = self::MODE_CASCADE): self
$this->initUow()->delete($entity, $mode === self::MODE_CASCADE);
public function run(): void
if ($this->uow === null) {
return;
$uow = $this->uow->run();
$this->uow = null;
if (!$uow->isSuccess()) {
throw $uow->getLastError();
private function initUow(): UnitOfWork
$this->uow ??= new UnitOfWork($this->orm, $this->runner);
return $this->uow;
This interface has been deprecated. The supplier of the interface has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the interface will be removed and what other interface to use instead.