We should improve this code:
EditEndpoint::getItemIdsFromPageIds()
/** * @param int[] $pageIds * @return ItemId[] */ private function getItemIdsFromPageIds( array $pageIds ) : array { $itemIds = []; foreach ( $pageIds as $pageId ) { $entityId = $this->entityIdLookup->getEntityIdForTitle( Title::newFromID( $pageId ) ); if ( $entityId && $entityId instanceof ItemId ) { $itemIds[] = $entityId; } } return $itemIds; }
- replace the Title static method with an injected TitleFactory
- instead of doing one method call per page ID (= one separate DB query per ID), use newFromIDs() and then EntityIdLookup::getEntityIds() to batch the work