Scalr\Api\Service\User\V1beta0\Controller\ScriptVersions::modifyAction PHP Method

modifyAction() public method

Change version attributes.
public modifyAction ( integer $scriptId, integer $versionNumber ) : Scalr\Api\DataType\ResultEnvelope
$scriptId integer Unique identifier of the script
$versionNumber integer Script version number
return Scalr\Api\DataType\ResultEnvelope
    public function modifyAction($scriptId, $versionNumber)
    {
        $this->checkPermissions(Acl::RESOURCE_SCRIPTS_ENVIRONMENT, Acl::PERM_SCRIPTS_ENVIRONMENT_MANAGE);
        $object = $this->request->getJsonBody();
        /* @var $versionAdapter ScriptVersionAdapter */
        $versionAdapter = $this->adapter('scriptVersion');
        //Pre validates the request object
        $versionAdapter->validateObject($object, Request::METHOD_PATCH);
        $version = $this->getVersion($scriptId, $versionNumber, true);
        $version->changedById = $this->getUser()->getId();
        $version->changedByEmail = $this->getUser()->getEmail();
        //Copies all alterable properties to fetched Role Entity
        $versionAdapter->copyAlterableProperties($object, $version);
        //Re-validates an Entity
        $versionAdapter->validateEntity($version);
        //Saves verified results
        $version->save();
        return $this->result($versionAdapter->toData($version));
    }