src/Kunstmaan/AdminListBundle/Service/EntityVersionLockService.php
protected function getLockableEntity(LockableEntityInterface $entity, $create = true)
    {
        /** @var LockableEntity $lockable */
        $lockable = $this->objectManager->getRepository('KunstmaanAdminListBundle:LockableEntity')->getOrCreate($entity->getId(), get_class($entity));

        if ($create === true && $lockable->getId() === null) {
            $this->objectManager->persist($lockable);
            $this->objectManager->flush();
        }

        return $lockable;
    }
protected function getLockableEntity(LockableEntityInterface $entity, $create = true)
    {
        /** @var LockableEntity $lockable */
        $lockable = $this->objectManager->getRepository('KunstmaanAdminListBundle:LockableEntity')->getOrCreate($entity->getId(), get_class($entity));

        if ($create === true && $lockable->getId() === null) {
            $this->objectManager->persist($lockable);
            $this->objectManager->flush();
        }

        return $lockable;
    }
protected function getLockableEntity ( LockableEntityInterface $ entity , $ create = true ) { /** @var LockableEntity $lockable */ $ lockable = $ this -> objectManager -> getRepository ( 'KunstmaanAdminListBundle:LockableEntity' ) -> getOrCreate ( $ entity -> getId ( ) , get_class ( $ entity ) ) ; if ( $ create === true && $ lockable -> getId ( ) === null ) { $ this -> objectManager -> persist ( $ lockable ) ; $ this -> objectManager -> flush ( ) ; } return $ lockable ; }
Get or create a LockableEntity for an entity with LockableEntityInterface

@param LockableEntityInterface $entity

@return LockableEntity
Get or create a LockableEntity for an entity with LockableEntityInterface