First record update after insert another record depends up on loop

This is my update function. This model array has 5 records . I want to update the first record and then insert four records in DB. Can anyone help me on how to implement loop inside this function : public function actionInsExistImg($model,$saveUrl,$uploadStatus) { if($model) { $dbh = Yii::$app->db->getDbh(); $stmt = oci_parse($dbh, “BEGIN Proc_Asp_Upd_Image_Data(null,:P_Item_Code,:P_Item_Name,:P_Item_Barcode, null,null,null,null,null,null,null, null,null,null,null,:P_Upload_Status,:P_Upload_Path,:P_Cre_Usr,:P_Edt_Usr,:P_Flag,:P_Out,:P_Msg…

How to update existing CMS block content using data patches?

I have updated content for the existing cms page by using data patches in Magento 2.3.3, but the same approach not working for CMS block. <?php namespace Test\CmsExport\Setup\Patch\Data; use Magento\Framework\Setup\Patch\DataPatchInterface; use Magento\Framework\Setup\Patch\PatchVersionInterface; use Magento\Framework\Setup\ModuleDataSetupInterface; use Magento\Cms\Model\BlockFactory; class UpdateTest2Block implements DataPatchInterface, PatchVersionInterface { private $blockFactory; private $moduleDataSetup; public function __construct( PageFactory $blockFactory, ModuleDataSetupInterface $moduleDataSetup ) {…

How to import 20.000 coupon codes in Magento 2 without paid

I want to import 20.000 coupon codes on my website, and for this reason, I created the following script: <?php use Magento\Framework\App\Bootstrap; /** * If your external file is in root folder */ require __DIR__ . ‘/app/bootstrap.php’; // Import CSV from ViArt format: $handle = fopen(‘coupons.csv’, ‘r’); $cols = array_flip(fgetcsv($handle)); while($data = fgetcsv($handle)) { if($data[$cols[‘is_active’]]…