mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-09-13 21:57:16 +02:00
Implemented optimistic lock draft
This commit is contained in:
25
application/src/Entity/Attribut/VersionAttribut.php
Normal file
25
application/src/Entity/Attribut/VersionAttribut.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
namespace App\Entity\Attribut;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author kevinfrantz
|
||||
*
|
||||
*/
|
||||
trait VersionAttribut
|
||||
{
|
||||
/**
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $version;
|
||||
|
||||
public function setVersion(int $version):void{
|
||||
$this->version = $version;
|
||||
}
|
||||
|
||||
public function getVersion():int{
|
||||
return $this->version;
|
||||
}
|
||||
}
|
||||
|
24
application/src/Entity/Attribut/VersionAttributInterface.php
Normal file
24
application/src/Entity/Attribut/VersionAttributInterface.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
namespace App\Entity\Attribut;
|
||||
|
||||
/**
|
||||
* Entities which implement this interface can lock stuff on an optimistic base.
|
||||
* @see https://www.doctrine-project.org/projects/doctrine-orm/en/2.6/reference/transactions-and-concurrency.html
|
||||
* @see https://en.wikipedia.org/wiki/Optimistic_concurrency_control
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
interface VersionAttributInterface
|
||||
{
|
||||
/**
|
||||
* Returns the revision version of the entity
|
||||
* @return int
|
||||
*/
|
||||
public function getVersion():int;
|
||||
|
||||
/**
|
||||
* Sets the revision version of the entity
|
||||
* @param int $version
|
||||
*/
|
||||
public function setVersion(int $version):void;
|
||||
}
|
||||
|
Reference in New Issue
Block a user