src/Kunstmaan/AdminListBundle/Service/EntityVersionLockService.php
protected function createEntityVersionLock(User $user, LockableEntity $entity)
    {
        /** @var EntityVersionLock $lock */
        $lock = $this->objectManager->getRepository('KunstmaanAdminListBundle:EntityVersionLock')->findOneBy([
            'owner' => $user->getUsername(),
            'lockableEntity' => $entity,
        ]);
        if (!$lock) {
            $lock = new EntityVersionLock();
        }
        $lock->setOwner($user->getUsername());
        $lock->setLockableEntity($entity);
        $lock->setCreatedAt(new \DateTime());
        $this->objectManager->persist($lock);
        $this->objectManager->flush();
    }
protected function createEntityVersionLock(User $user, LockableEntity $entity)
    {
        /** @var EntityVersionLock $lock */
        $lock = $this->objectManager->getRepository('KunstmaanAdminListBundle:EntityVersionLock')->findOneBy([
            'owner' => $user->getUsername(),
            'lockableEntity' => $entity,
        ]);
        if (!$lock) {
            $lock = new EntityVersionLock();
        }
        $lock->setOwner($user->getUsername());
        $lock->setLockableEntity($entity);
        $lock->setCreatedAt(new \DateTime());
        $this->objectManager->persist($lock);
        $this->objectManager->flush();
    }
protected function createEntityVersionLock ( User $ user , LockableEntity $ entity ) { /** @var EntityVersionLock $lock */ $ lock = $ this -> objectManager -> getRepository ( 'KunstmaanAdminListBundle:EntityVersionLock' ) -> findOneBy ( [ 'owner' => $ user -> getUsername ( ) , 'lockableEntity' => $ entity , ] ) ; if ( ! $ lock ) { $ lock = new EntityVersionLock ( ) ; } $ lock -> setOwner ( $ user -> getUsername ( ) ) ; $ lock -> setLockableEntity ( $ entity ) ; $ lock -> setCreatedAt ( new \ DateTime ( ) ) ; $ this -> objectManager -> persist ( $ lock ) ; $ this -> objectManager -> flush ( ) ; }
When editing the entity, create a new entity translation lock.

@param User           $user
@param LockableEntity $entity
When editing the entity create a new entity translation lock .