1. Go to this page and download the library: Download lorenzo/row-locker library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
lorenzo / row-locker example snippets
use RowLocker\LockableInterface;
use RowLocker\LockableTrait;
...
class Article extends Entity implements LockableInterface
{
use LockableTrait;
...
}
class ArticlesTable extends Table
{
public function initialize()
{
...
$this->addBehavior('RowLocker.RowLocker');
}
}
$article = $articlesTable->get($id);
$article->lock($userId, $sessionId); // both arguments are actaully optional
$articlesTable->save($article);