entity_generic-8.x-3.x-dev/src/Generic/EntityLockedTrait.php
src/Generic/EntityLockedTrait.php
<?php
namespace Drupal\entity_generic\Generic;
/**
* Implements "locked" functionality for the entity.
*/
trait EntityLockedTrait {
/**
* A locked state.
*
* @var string
*/
protected $locked;
/**
* {@inheritdoc}
*/
public function isLocked() {
return (bool) $this->locked ? $this->locked : FALSE;
}
/**
* {@inheritdoc}
*/
public function setLock($locker) {
return $this->set('locker', $locker);
}
/**
* {@inheritdoc}
*/
public function releaseLock() {
return $this->set('locker', NULL);
}
}
