Skip to content

Commit 77904df

Browse files
committed
Add support for lowercase id key
1 parent 4471f2d commit 77904df

2 files changed

Lines changed: 22 additions & 4 deletions

File tree

.tasks/538/plan.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -602,10 +602,14 @@ the single `update()` method) — document this in the method docblock.
602602
parameter in batch commands, but `Core\Batch::deleteEntityItems()` sends uppercase `ID` — confirmed
603603
by a live batch-delete integration test failure (`could not find value for parameter {id}`). Fixed
604604
by adding `src/Services/Catalog/ProductProperty/Batch.php extends \Bitrix24\SDK\Core\Batch`,
605-
overriding `deleteEntityItems()` to send `['id' => $itemId]`, following the exact
606-
`Services\Task\Batch`/`Services\CRM\Currency\Batch` pattern. Wired into
607-
`CatalogServiceBuilder::productProperty()` by constructing `new Catalog\ProductProperty\Batch($this->core, $this->log)`
608-
instead of reusing the shared `$this->batch`, matching `CRMServiceBuilder::currency()`.
605+
overriding `deleteEntityItems()` to send `['id' => $itemId]`. Also overrides
606+
`determineKeyId()` to return lowercase `'id'`, matching the more recent reference implementation
607+
`Services\Biconnector\Connector\Batch`/`Services\Biconnector\Source\Batch` (which additionally
608+
override list pagination for a `page`-based method — not needed here since
609+
`catalog.productProperty.list` uses standard `start`-based pagination, so only `deleteEntityItems()`
610+
and `determineKeyId()` are overridden). Wired into `CatalogServiceBuilder::productProperty()` by
611+
constructing `new Catalog\ProductProperty\Batch($this->core, $this->log)` instead of reusing the
612+
shared `$this->batch`, matching `CRMServiceBuilder::currency()`.
609613

610614
No separate `ProductPropertyServiceBuilder.php` file is needed — `ProductProperty` is registered
611615
directly inside the existing `src/Services/Catalog/CatalogServiceBuilder.php` (see Files to Modify

src/Services/Catalog/ProductProperty/Batch.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,24 @@
2121
/**
2222
* Class Batch
2323
*
24+
* Overrides base Batch to handle a parameter naming difference in catalog.productProperty.* REST
25+
* methods: delete uses lowercase 'id' instead of 'ID'.
26+
*
27+
* @see https://apidocs.bitrix24.com/api-reference/catalog/product-property/catalog-product-property-delete.html
28+
*
2429
* @package Bitrix24\SDK\Services\Catalog\ProductProperty
2530
*/
2631
class Batch extends \Bitrix24\SDK\Core\Batch
2732
{
33+
/**
34+
* Determines the ID key — lowercase 'id' for catalog product property
35+
*/
36+
#[\Override]
37+
protected function determineKeyId(string $apiMethod, ?array $additionalParameters): string
38+
{
39+
return 'id';
40+
}
41+
2842
/**
2943
* Delete entity items with batch call
3044
*

0 commit comments

Comments
 (0)