# ivyforms/1.1.1/backend/src/Controllers/Entry/BulkUpdateEntryController.php

The Innovative Form Builder – IvyForms, version 1.1.1. 83 lines.

- Page: https://pluginprobe.com/plugins/ivyforms/1.1.1/code/backend/src/Controllers/Entry/BulkUpdateEntryController.php
- Raw: https://pluginprobe.com/plugins/ivyforms/1.1.1/raw/backend/src/Controllers/Entry/BulkUpdateEntryController.php
- Modified: 2026-05-06T08:31:02+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/ivyforms/1.1.1/code/backend/src/Controllers/Entry/BulkUpdateEntryController.php#L10-L20`.

```php
<?php

namespace IvyForms\Controllers\Entry;

use IvyForms\Common\Exceptions\InvalidArgumentException;
use IvyForms\Common\Sanitizer\Sanitizer;
use IvyForms\Controllers\Controller;
use IvyForms\Services\Entry\EntryService;
use IvyForms\Services\Translations\BackendStrings;
use WP_REST_Request;
use WP_REST_Response;

/**
 * Class BulkUpdateEntryController
 *
 * @package IvyForms\Controllers\Entry
 */
class BulkUpdateEntryController extends Controller
{
    private EntryService $entryService;

    public function __construct(EntryService $entryService)
    {
        $this->entryService = $entryService;
    }

    /**
     * Handle bulk update request for entries
     *
     * @param WP_REST_Request $data
     *
     * @return WP_REST_Response
     *
     * @throws InvalidArgumentException
     */
    public function handle(WP_REST_Request $data): WP_REST_Response
    {
        // Verify the nonce
        Sanitizer::verifyNonce($data->get_header('X-WP-Nonce'));

        // Check if the entry data is provided
        if (empty($data->get_params())) {
            throw new InvalidArgumentException(
                BackendStrings::getExceptionStrings()['invalid_request_data']
            );
        }

        // Sanitize request data
        $sanitized = Sanitizer::sanitizeBulkUpdateData([
            'column' => $data->get_param('column'),
            'value' => $data->get_param('value'),
            'ids' => $data->get_param('ids'),
        ]);

        // Validate IDs
        if (empty($sanitized['ids'])) {
            return new WP_REST_Response([
                'success' => false,
                'message' => BackendStrings::getExceptionStrings()['invalid_or_missing_ids'],
            ], 400);
        }

        // Validate column
        if (empty($sanitized['column'])) {
            return new WP_REST_Response([
                'success' => false,
                'message' => BackendStrings::getExceptionStrings()['table_or_attribute_not_allowed'],
            ], 400);
        }

        $this->entryService->getEntryManager()->bulkUpdateColumn(
            $sanitized['column'],
            $sanitized['value'],
            $sanitized['ids']
        );

        return new WP_REST_Response([
            'success' => true,
            'message' => BackendStrings::getExceptionStrings()['batch_update_successful'],
        ], 200);
    }
}

```
