PHP code example of webonaute / doctrine-datalocking-bundle

1. Go to this page and download the library: Download webonaute/doctrine-datalocking-bundle 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/ */

    

webonaute / doctrine-datalocking-bundle example snippets

 
    use Webonaute\DoctrineDataLockingBundle\Entity\ProcessLock;
    
    ... 
    
    /**
     * @var ProcessLock
     *
     * @ORM\Embedded(class=ProcessLock::class)
     */
    private $processLock;
     
    ...
     
    public function __construct()
    {
        ...
        $this->processLock = new ProcessLock();
    }

    /**
     * @return ProcessLock
     */
    public function getProcessLock(): ProcessLock
    {
        return $this->processLock;
    }     

while (null !== $lockId = $dataLockerService->lock(Entity::class, 500, $extraWhere, $lockAt)) {
    $this->queue->push($lockId);
}