Zum Inhalt springen

Missing Bulk Operation (ARCH7053)

Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.

Key php.orm.missing-bulk-operation · Severity warning · Category orm

Repeating single-row operations in a loop when a bulk/batch API exists (insert, createMany, upsert) is wasteful. Collapsing to one bulk call drastically reduces round-trips.

<?php
foreach ($items as $item) {
Product::create(['sku' => $item['sku']]); // one INSERT per row
}
<?php
$payload = array_map(fn($i) => ['sku' => $i['sku']], $items);
Product::insert($payload); // single bulk INSERT

Collapse the repeated single-row operations into a bulk API like insert/createMany.