YellowCube Insert Article

To add a new article to YellowCube, create a new Article and pass it to YellowCube/Service::insertArticleMasterData().

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;
    ->setNetWeight(0.042, ISO::KGM)
    ->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;

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] =>