To add a new article to YellowCube, create a new Article
and pass it to
YellowCube/Service::insertArticleMasterData()
.
- Warning
- There is no exception, if an article already exists.
use YellowCube\ART\Article;
use YellowCube\ART\ChangeFlag;
use YellowCube\ART\UnitsOfMeasure\ISO;
$article = new Article;
$article
->setChangeFlag(ChangeFlag::INSERT)
->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');
For a full description of all possible Article
parameters please consult
the YellowCube SOAP Interface Manual. There are setters for these parameters on the Article
object.
Pass this article to the insertArticleMasterData
method.
$service = new YellowCube\Service(YellowCube\Config::testConfig());
$response = $service->insertArticleMasterData($article);
echo "Successfully added article with reference {$response->getReference()}." . PHP_EOL . PHP_EOL;
print_r($response);
When running this code a GEN_Response
is returned.
Successfully added article with reference 14288.
YellowCube\GEN_Response Object
(
[EventTimestamp:protected] => 2015-04-14T09:30:05Z
[MessageType:protected] => ART
[StatusCode:protected] => 10
[StatusType:protected] => S
[StatusText:protected] => File received
[Reference:protected] => 14288
[Reference1:protected] =>
[Reference2:protected] =>
[Reference3:protected] =>
[Reference4:protected] =>
)