To update an existing article in YellowCube, create a new Article
with a ChangeFlag::UPDATE
and pass it to YellowCube/Service::insertArticleMasterData()
.
use YellowCube\ART\Article;
use YellowCube\ART\ChangeFlag;
use YellowCube\ART\UnitsOfMeasure\ISO;
$article = new Article;
$article
->setChangeFlag(ChangeFlag::UPDATE)
->setPlantID('Y012')
->setDepositorNo('0000040750')
->setArticleNo('47686-3009-35/38')
->setBaseUOM(ISO::PCE)
->setNetWeight(0.042, ISO::KGM)
->setAlternateUnitISO(ISO::PCE)
->addArticleDescription('Ich wars nicht.', 'de');
- Hint
- Make sure to set the change flag to
ChangeFlag::UPDATE
.
Pass this article to the insertArticleMasterData
method.
$service = new YellowCube\Service(YellowCube\Config::testConfig());
$response = $service->insertArticleMasterData($article);
echo "Successfully updated article with reference {$response->getReference()}." . PHP_EOL . PHP_EOL;
print_r($response);
Running this code, a GEN_Response
is returned.
Successfully updated article with reference 14285.
YellowCube\GEN_Response Object
(
[EventTimestamp:protected] => 2015-04-14T09:30:00Z
[MessageType:protected] => ART
[StatusCode:protected] => 10
[StatusType:protected] => S
[StatusText:protected] => File received
[Reference:protected] => 14285
[Reference1:protected] =>
[Reference2:protected] =>
[Reference3:protected] =>
[Reference4:protected] =>
)