PHP code example of tad80 / optimisticlock

1. Go to this page and download the library: Download tad80/optimisticlock 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/ */

    

tad80 / optimisticlock example snippets


class Post extends AppModel {
	public $actsAs = array('OptimisticLock.OptimisticLock');
}

class Post extends AppModel {
	public $actsAs = array(
		'OptimisticLock.OptimisticLock' => array(
			'field' => 'modified',
			'message' => 'Update conflict, another user has already updated the record. Please list and edit the record again.',
		),
	);
}

$this->Html->form->input('Post.id', array('type' => 'hidden'));
$this->Html->form->input('Post.modified', array('type' => 'hidden', 'name' => 'data[Post][opt_modified]'));