src/CMDBCategory.php
public function batchUpdate(array $objectIDs, $categoryConst, array $attributes) {
        $requests = [];

        foreach ($objectIDs as $objectID) {
            $requests[] = [
                'method' => 'cmdb.category.update',
                'params' => [
                    'objID' => $objectID,
                    'category' => $categoryConst,
                    'data' => $attributes
                ]
            ];
        }

        $results = $this->api->batchRequest($requests);

        foreach ($results as $result) {
            if (!array_key_exists('success', $result) ||
                $result['success'] !== true) {
                if (array_key_exists('message', $result)) {
                    throw new RuntimeException(sprintf('Bad result: %s', $result['message']));
                } else {
                    throw new RuntimeException('Bad result');
                }
            }
        }

        return $this;
    }
public function batchUpdate(array $objectIDs, $categoryConst, array $attributes) {
        $requests = [];

        foreach ($objectIDs as $objectID) {
            $requests[] = [
                'method' => 'cmdb.category.update',
                'params' => [
                    'objID' => $objectID,
                    'category' => $categoryConst,
                    'data' => $attributes
                ]
            ];
        }

        $results = $this->api->batchRequest($requests);

        foreach ($results as $result) {
            if (!array_key_exists('success', $result) ||
                $result['success'] !== true) {
                if (array_key_exists('message', $result)) {
                    throw new RuntimeException(sprintf('Bad result: %s', $result['message']));
                } else {
                    throw new RuntimeException('Bad result');
                }
            }
        }

        return $this;
    }
public function batchUpdate ( array $ objectIDs , $ categoryConst , array $ attributes ) { $ requests = [ ] ; foreach ( $ objectIDs as $ objectID ) { $ requests [ ] = [ 'method' => 'cmdb.category.update' , 'params' => [ 'objID' => $ objectID , 'category' => $ categoryConst , 'data' => $ attributes ] ] ; } $ results = $ this -> api -> batchRequest ( $ requests ) ; foreach ( $ results as $ result ) { if ( ! array_key_exists ( 'success' , $ result ) || $ result [ 'success' ] !== true ) { if ( array_key_exists ( 'message' , $ result ) ) { throw new RuntimeException ( sprintf ( 'Bad result: %s' , $ result [ 'message' ] ) ) ; } else { throw new RuntimeException ( 'Bad result' ) ; } } } return $ this ; }
Update single-value category for one or more objects

@param array $objectIDs List of object identifiers as integers
@param string $categoryConst Category constant
@param array $attributes Attributes as key-value pairs

@return self Returns itself

@throws Exception on error
Update single - value category for one or more objects