2

I am following tutorials at http://alanstorm.com/magento_2_crud_models_for_database_access/ for creating my extension but theres one key part of that tutorial that appears to be out of date.

This Part :

$todo = $this->toDoFactory->create();
$todo->setData('item_text','Finish my Magento article')
->save();

SetData and Save no longer work this way.

So how can I use a Collection Factory to create a new item in my table?

1

Nevermind, I figured it out.

First you would do $this->toDoFactory->create()->getNewEmptyItem(); And then continue on with setting data and saving.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.