Skip to content

Commit fd7dd02

Browse files
authored
Merge pull request #48 from HPInc/feat-set-sourceComponentId
feat: set sourceComponentId on component
2 parents 7bd4ab0 + 320e84f commit fd7dd02

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/order/orderData/item/component/component.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ class OneFlowComponent extends OneFlowBase {
1818
*/
1919
public function init() {
2020
$this->__addProperty("componentId");
21+
$this->__addProperty("sourceComponentId");
2122
$this->__addProperty("type");
2223
$this->__addProperty("code");
2324
$this->__addProperty("path");
@@ -269,6 +270,17 @@ public function setComponentId($componentId) {
269270
$this->componentId = $componentId;
270271
}
271272

273+
/**
274+
* setSourceComponentId function.
275+
*
276+
* @access public
277+
* @param mixed $sourceComponentId
278+
* @return void
279+
*/
280+
public function setSourceComponentId($sourceComponentId) {
281+
$this->sourceComponentId = $sourceComponentId;
282+
}
283+
272284
/**
273285
* addAttribute function.
274286
*

tests/order/orderTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ public function testCanBuildASingleItemOrder()
3232
]);
3333

3434
$component = $item->newComponent('componentCode');
35+
$component->setSourceComponentId('my-source-component-id');
3536
$component->setFetchUrl('http://site.com/file.pdf');
3637
$component->setLocalFile(false);
3738
$component->setBarcode('customComponentBarcode');
@@ -151,6 +152,7 @@ public function testCanBuildASingleItemOrder()
151152
$this->assertEquals(1, count($outputItem->components));
152153
$outputComponent = $outputItem->components[0];
153154
$this->assertEquals('componentCode', $outputComponent->code);
155+
$this->assertEquals('my-source-component-id', $outputComponent->sourceComponentId);
154156
$this->assertEquals('http://site.com/file.pdf', $outputComponent->path);
155157
$this->assertEquals('customComponentBarcode', $outputComponent->barcode);
156158
$this->assertEquals(true, $outputComponent->fetch);

0 commit comments

Comments
 (0)