1

In DB I have Rows:

ID NAME PHONE

Example:

1 Steave 33333333
2 Joe 77777

I can add and Edit any row, but I want when I click "save everyone" I rewrote all phones on DB example:

1 Steave 33333333
    2 Joe 77777

click "edit Joe" - >>> XML Form rewrote phone on "555555" Click "save everyone" - >>> Controller\Adminthml\Slider\SaveEvryone.php

- DO THIS

but how? If I want to rewrote one item, I create model

 $model = $this->userFactory->create();

after

$id = $this->getRequest()->getParam('user_id');
        if ($id) {
            try {
                $model = $this->sliderRepository->getById($id);
            } catch (LocalizedException $e) {
                $this->messageManager->addErrorMessage(__('This slider no longer exists.'));
                return $resultRedirect->setPath('*/*/');
            }
        }
$model->setData($data);
$this->sliderRepository->save($model);

but dont know how rewrite some models :[

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.