src/Graviton/SchemaBundle/Constraint/VersionServiceConstraint.php
private function getUserVersion($object)
    {
        if ($this->utils->getCurrentRequestMethod() == 'PATCH') {
            $content = json_decode($this->utils->getCurrentRequestContent(), true);

            $hasVersion = array_filter(
                $content,
                function ($val) {
                    if ($val['path'] == '/'.self::FIELD_NAME) {
                        return true;
                    }
                    return false;
                }
            );

            if (empty($hasVersion)) {
                return -1;
            }
        }

        return $this->getVersionFromObject($object);
    }
private function getUserVersion($object)
    {
        if ($this->utils->getCurrentRequestMethod() == 'PATCH') {
            $content = json_decode($this->utils->getCurrentRequestContent(), true);

            $hasVersion = array_filter(
                $content,
                function ($val) {
                    if ($val['path'] == '/'.self::FIELD_NAME) {
                        return true;
                    }
                    return false;
                }
            );

            if (empty($hasVersion)) {
                return -1;
            }
        }

        return $this->getVersionFromObject($object);
    }
private function getUserVersion ( $ object ) { if ( $ this -> utils -> getCurrentRequestMethod ( ) == 'PATCH' ) { $ content = json_decode ( $ this -> utils -> getCurrentRequestContent ( ) , true ) ; $ hasVersion = array_filter ( $ content , function ( $ val ) { if ( $ val [ 'path' ] == '/' . self :: FIELD_NAME ) { return true ; } return false ; } ) ; if ( empty ( $ hasVersion ) ) { return - 1 ; } } return $ this -> getVersionFromObject ( $ object ) ; }
Gets the user provided version, handling different scenarios

@param object $object object

@return int|null null or the specified version
Gets the user provided version handling different scenarios