Skip to main content
deleted 8 characters in body
Source Link
Amit Bera
  • 77.7k
  • 20
  • 124
  • 239

As per Magento standard, the second option is right to add a new record to an entity using the repository.

If you want to update exist then you have to load the record by a primary key using getById()

$slider = $this->sliderDataFactory->create()>sliderRepository->load>getById('PKID');

$this->sliderRepository->save($slider);

As per Magento standard, the second option is right to add a new record to an entity using the repository.

If you want to update exist then you have to load the record by a primary key using getById()

$slider = $this->sliderDataFactory->create()->load('PKID');

$this->sliderRepository->save($slider);

As per Magento standard, the second option is right to add a new record to an entity using the repository.

If you want to update exist then you have to load the record by a primary key using getById()

$slider = $this->sliderRepository->getById('PKID');

$this->sliderRepository->save($slider);
Source Link
Amit Bera
  • 77.7k
  • 20
  • 124
  • 239

As per Magento standard, the second option is right to add a new record to an entity using the repository.

If you want to update exist then you have to load the record by a primary key using getById()

$slider = $this->sliderDataFactory->create()->load('PKID');

$this->sliderRepository->save($slider);