src/Kunstmaan/NodeBundle/Helper/NodeAdmin/NodeVersionLockHelper.php
protected function createNodeVersionLock(BaseUser $user, NodeTranslation $nodeTranslation, $isPublicVersion)
    {
        $lock = $this->objectManager->getRepository('KunstmaanNodeBundle:NodeVersionLock')->findOneBy([
            'owner' => $user->getUsername(),
            'nodeTranslation' => $nodeTranslation,
            'publicVersion' => $isPublicVersion,
        ]);
        if (!$lock) {
            $lock = new NodeVersionLock();
        }
        $lock->setOwner($user->getUsername());
        $lock->setNodeTranslation($nodeTranslation);
        $lock->setPublicVersion($isPublicVersion);
        $lock->setCreatedAt(new \DateTime());

        $this->objectManager->persist($lock);
        $this->objectManager->flush();
    }
protected function createNodeVersionLock(BaseUser $user, NodeTranslation $nodeTranslation, $isPublicVersion)
    {
        $lock = $this->objectManager->getRepository('KunstmaanNodeBundle:NodeVersionLock')->findOneBy([
            'owner' => $user->getUsername(),
            'nodeTranslation' => $nodeTranslation,
            'publicVersion' => $isPublicVersion,
        ]);
        if (!$lock) {
            $lock = new NodeVersionLock();
        }
        $lock->setOwner($user->getUsername());
        $lock->setNodeTranslation($nodeTranslation);
        $lock->setPublicVersion($isPublicVersion);
        $lock->setCreatedAt(new \DateTime());

        $this->objectManager->persist($lock);
        $this->objectManager->flush();
    }
protected function createNodeVersionLock ( BaseUser $ user , NodeTranslation $ nodeTranslation , $ isPublicVersion ) { $ lock = $ this -> objectManager -> getRepository ( 'KunstmaanNodeBundle:NodeVersionLock' ) -> findOneBy ( [ 'owner' => $ user -> getUsername ( ) , 'nodeTranslation' => $ nodeTranslation , 'publicVersion' => $ isPublicVersion , ] ) ; if ( ! $ lock ) { $ lock = new NodeVersionLock ( ) ; } $ lock -> setOwner ( $ user -> getUsername ( ) ) ; $ lock -> setNodeTranslation ( $ nodeTranslation ) ; $ lock -> setPublicVersion ( $ isPublicVersion ) ; $ lock -> setCreatedAt ( new \ DateTime ( ) ) ; $ this -> objectManager -> persist ( $ lock ) ; $ this -> objectManager -> flush ( ) ; }
When editing the node, create a new node translation lock.

@param BaseUser        $user
@param NodeTranslation $nodeTranslation
@param bool            $isPublicVersion
When editing the node create a new node translation lock .