1

Just curious to know What is use of setIsObjectNew while saving a model factory object, I see most of the time while creating console command it's set to true ?

Below is sample code used in Console command execute method:

$item = $this->itemFactory->create();
$item->setName($input->getArgument(self::INPUT_KEY_NAME));
$item->setDescription($input->getArgument(self::INPUT_KEY_DESCRIPTION));
$item->setIsObjectNew(true);
$item->save(); 

Thanks

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.