db = $db; } public function process(array $row, int $cnt): void { if (count($row) < 2) { echo "{$cnt} {$row[0]}:{$row[1]}-> SKIP PARTCODE\n"; return; } $temps = []; $temps['type'] = trim($row[0]); $temps['title'] = trim($row[1]); $temps['price'] = trim($row[2]); $temps['status'] = PartEntity::DEFAULT_STATUS; // Assuming SwitchEntity has a STATUS_DEFAULT constant if (!$this->db->table('partinfo')->insert($temps)) { throw new \Exception($this->db->error()['message']); } echo "{$cnt} -> {$temps['title']} PARTCODE 완료.\n"; } }