public function unlock()
    {
        $this->count--;

        if ($this->count < 0) {
            $this->count = 0;
            return false;
        }

        if (0 === $this->count) {
            $this->entityManager->flush();

            return true;
        }

        return false;
    }
public function unlock()
    {
        $this->count--;

        if ($this->count < 0) {
            $this->count = 0;
            return false;
        }

        if (0 === $this->count) {
            $this->entityManager->flush();

            return true;
        }

        return false;
    }
public function unlock ( ) { $ this -> count -- ; if ( $ this -> count < 0 ) { $ this -> count = 0 ; return false ; } if ( 0 === $ this -> count ) { $ this -> entityManager -> flush ( ) ; return true ; } return false ; }
Call this at the end of a persistence function.

@return boolean True if flush was called.
Call this at the end of a persistence function .