Jackalope\Item::setState PHP Method

setState() private method

Change the state of the item
private setState ( integer $state )
$state integer The new item state, one of the state constants
    private function setState($state)
    {
        if (!in_array($state, $this->available_states)) {
            throw new RepositoryException("Invalid state [{$state}]");
        }
        $this->state = $state;
        // -------------------------------------------------------------------------------------
        // see the phpdoc of rollbackTransaction()
        //
        // In the cases 6 and 7, when the state is CLEAN before the TRX and CLEAN at the end of
        // the TRX, the final state will be different if the item has been modified during
        // the TRX or not.
        //
        // The following test covers that special case, if the item is modified during the TRX,
        // we set the saved state to MODIFIED so that it can be restored as it is when the TRX
        // is rolled back.
        if (self::STATE_MODIFIED === $state && self::STATE_CLEAN === $this->savedState) {
            $this->savedState = self::STATE_MODIFIED;
        }
    }