public function removeAttribute(...$attributes)
    {
        $keySet = !empty(array_filter($this->model->getKeys()));

        if (!$keySet) {
            $analyzer = $this->getConditionAnalyzer();

            if (!$analyzer->isExactSearch()) {
                throw new InvalidQuery('Need to provide the key in your query');
            }

            $id = $analyzer->identifierConditionValues();
            $this->model->setId($id);
        }

        $key = DynamoDb::marshalItem($this->model->getKeys());

        $this->resetExpressions();

        /** @var \Aws\Result $result */
        $result = DynamoDb::table($this->model->getTable())
            ->setKey($key)
            ->setUpdateExpression($this->updateExpression->remove($attributes))
            ->setExpressionAttributeNames($this->expressionAttributeNames->all())
            ->setReturnValues('ALL_NEW')
            ->prepare($this->client)
            ->updateItem();

        $success = array_get($result, '@metadata.statusCode') === 200;

        if ($success) {
            $this->model->setRawAttributes(DynamoDb::unmarshalItem($result->get('Attributes')));
            $this->model->syncOriginal();
        }

        return $success;
    }
public function removeAttribute(...$attributes)
    {
        $keySet = !empty(array_filter($this->model->getKeys()));

        if (!$keySet) {
            $analyzer = $this->getConditionAnalyzer();

            if (!$analyzer->isExactSearch()) {
                throw new InvalidQuery('Need to provide the key in your query');
            }

            $id = $analyzer->identifierConditionValues();
            $this->model->setId($id);
        }

        $key = DynamoDb::marshalItem($this->model->getKeys());

        $this->resetExpressions();

        /** @var \Aws\Result $result */
        $result = DynamoDb::table($this->model->getTable())
            ->setKey($key)
            ->setUpdateExpression($this->updateExpression->remove($attributes))
            ->setExpressionAttributeNames($this->expressionAttributeNames->all())
            ->setReturnValues('ALL_NEW')
            ->prepare($this->client)
            ->updateItem();

        $success = array_get($result, '@metadata.statusCode') === 200;

        if ($success) {
            $this->model->setRawAttributes(DynamoDb::unmarshalItem($result->get('Attributes')));
            $this->model->syncOriginal();
        }

        return $success;
    }
public function removeAttribute ( ... $ attributes ) { $ keySet = ! empty ( array_filter ( $ this -> model -> getKeys ( ) ) ) ; if ( ! $ keySet ) { $ analyzer = $ this -> getConditionAnalyzer ( ) ; if ( ! $ analyzer -> isExactSearch ( ) ) { throw new InvalidQuery ( 'Need to provide the key in your query' ) ; } $ id = $ analyzer -> identifierConditionValues ( ) ; $ this -> model -> setId ( $ id ) ; } $ key = DynamoDb :: marshalItem ( $ this -> model -> getKeys ( ) ) ; $ this -> resetExpressions ( ) ; /** @var \Aws\Result $result */ $ result = DynamoDb :: table ( $ this -> model -> getTable ( ) ) -> setKey ( $ key ) -> setUpdateExpression ( $ this -> updateExpression -> remove ( $ attributes ) ) -> setExpressionAttributeNames ( $ this -> expressionAttributeNames -> all ( ) ) -> setReturnValues ( 'ALL_NEW' ) -> prepare ( $ this -> client ) -> updateItem ( ) ; $ success = array_get ( $ result , '@metadata.statusCode' ) === 200 ; if ( $ success ) { $ this -> model -> setRawAttributes ( DynamoDb :: unmarshalItem ( $ result -> get ( 'Attributes' ) ) ) ; $ this -> model -> syncOriginal ( ) ; } return $ success ; }
Remove attributes from an existing item

@param array ...$attributes
@return bool
@throws InvalidQuery
Remove attributes from an existing item