![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/mautic.corals.io/app/bundles/CoreBundle/Entity/ |
<?php declare(strict_types=1); namespace Mautic\CoreBundle\Entity; use Doctrine\DBAL\Types\Types; use Mautic\CoreBundle\Doctrine\Mapping\ClassMetadataBuilder; /** * This trait provides default implementation of OptimisticLockInterface. */ trait OptimisticLockTrait { private int $version = 1; private ?int $currentVersion; private bool $incrementVersion = false; public function getVersion(): int { return $this->currentVersion ?? $this->version; } public function setVersion(int $version): void { $this->currentVersion = $version; $this->incrementVersion = false; } public function isMarkedForVersionIncrement(): bool { return $this->incrementVersion; } public function markForVersionIncrement(): void { $this->incrementVersion = true; } public function getVersionField(): string { return 'version'; } private static function addVersionField(ClassMetadataBuilder $builder): void { $builder->createField('version', Types::INTEGER) ->columnName('version') ->option('default', 1) ->option('unsigned', true) ->build(); } }