Hallo zusammen Ich möchte ein Artikel den ich eingelesen, aktualisieren. Nun wenn ich den 1:1 mit dem Rest-API via “put” Operation (Update) zurückschreibe dann erhalte ich folgende Fehlermeldung: {“success”:false,“message”:"\Shopware\Models\Article\Price by id 894 not found"} In der DB ist aber in der Tabelle “s_articles_prices” der Eintrag 894 vorhanden und stimmt mit der Artikel ID und Artikel Detail ID überein. - Price ID: 894 - article ID: 185 - articledetails ID: 775 Was mache ich falsch? So eine 1:1 Operation (Lesen & Update) sollte doch eigentlich gehen? Danke für Ratschläge und Hints. Hier noch der Price Array wie ich ihn zurückschicke: "prices":[{"id":894, "articleId":185, "articleDetailsId":775, "customerGroupKey":"EK", "from":1, "to":"beliebig", "price":36.111111111111, "pseudoPrice":0, "basePrice":0, "percent":0, "customerGroup":{"id":1, "key":"EK", "name":"Shopkunden", "tax":true, "taxInput":true, "mode":false, "discount":0, "minimumOrder":10, "minimumOrderSurcharge":5}}]
Hier noch der gesamte serialisierte JSON Request: [code]{“id”:185,“name”:“Burnt T-Shirt”,“mainDetailId”:775, “mainDetail”:{“id”:775,“articleId”:185,“number”:“SKT-AFG-2-3”,“kind”:1,“active”:true,“position”:0,“minPurchase”:1,“shippingFree”:false, “prices”:[[{“id”:894,“articleId”:185,“articleDetailsId”:775,“customerGroupKey”:“EK”,“from”:1,“to”:“beliebig”,“price”:36.111111111111,“pseudoPrice”:0,“basePrice”:0,“percent”:0,“customerGroup”:{“id”:1,“key”:“EK”,“name”:“Shopkunden”,“tax”:true,“taxInput”:true,“mode”:false,“discount”:0,“minimumOrder”:10,“minimumOrderSurcharge”:5}}], “configuratorOptions”:[{“id”:125,“groupId”:19,“name”:“Black”,“position”:0,“option”:“Black”}, {“id”:127,“groupId”:20,“name”:“S”,“position”:0,“option”:“S”}]}, “active”:true,“taxId”:5, “tax”:{“id”:5,“tax”:8.0,“name”:“Standard”}, “lastStock”:false, “categories”:{“41”:{“id”:41,“name”:“T-Shirts”,“active”:true,“position”:21,“parentId”:40,“childrenCount”:0,“articleCount”:0}}, “supplierId”:14, “supplier”:{“id”:14,“name”:“Thrasher”,“image”:"",“link”:"",“changed”:“2015-08-16T19:29:21+0200”},“filterGroupId”:12,“configuratorSetId”:127, “configuratorSet”:{“name”:“Set-SKT-AFG-2-3”, “groups”:[{“name”:“Design”,“options”:[{“name”:“Black”,“group”:“Design”,“option”:“Black”}, {“name”:“Charcoal”,“group”:“Design”,“option”:“Charcoal”}]},{“name”:“Size”, “options”: [{“name”:“S”,“group”:“Size”,“option”:“S”},{“name”:“M”,“group”:“Size”,“option”:“M”}, {“name”:“L”,“group”:“Size”,“option”:“L”}, {“name”:“XL”,“group”:“Size”,“option”:“XL”}]}]},“propertyValues”:[{“id”:325,“value”:“Black”,“position”:0,“optionId”:27,“valueNumeric”:“0.00”}, {“id”:326,“value”:“S”,“position”:0,“optionId”:28,“valueNumeric”:“0.00”}, {“id”:327,“value”:“M”,“position”:0,“optionId”:28,“valueNumeric”:“0.00”}, {“id”:328,“value”:“L”,“position”:0,“optionId”:28,“valueNumeric”:“0.00”}, {“id”:329,“value”:“XL”,“position”:0,“optionId”:28,“valueNumeric”:“0.00”}, {“id”:330,“value”:“Charcoal”,“position”:0,“optionId”:27,“valueNumeric”:“0.00”}], “propertyGroup”:{“id”:12,“name”:“Standard”,“position”:0,“comparable”:false,“sortMode”:0}, “descriptionLong”:"
In the original charcoal colorway, this “throwback” T-shirt design is a tribute to those skaters among us with a slightly more DIY approach to rolling through life. Heavyweight 100% pre-shrunk cotton T-shirt.
“}” [/code] und hier noch der Stack Trace aus dem Log file: [2015-08-17 19:37:09] core.ERROR: exception 'Shopware\Components\Api\Exception\CustomValidationException' with message '\Shopware\Models\Article\Price by id 894 not found' in D:\Documents\Projects\BigPicture\Skateshop\shop\engine\Shopware\Components\Api\Resource\Resource.php:396 Stack trace: #0 D:\Documents\Projects\BigPicture\Skateshop\shop\engine\Shopware\Components\Api\Resource\Variant.php(615): Shopware\Components\Api\Resource\Resource-\>getOneToManySubElement(Object(Doctrine\ORM\PersistentCollection), Array, '\\Shopware\\Model...') #1 D:\Documents\Projects\BigPicture\Skateshop\shop\engine\Shopware\Components\Api\Resource\Variant.php(396): Shopware\Components\Api\Resource\Variant-\>preparePriceAssociation(Array, Object(Shopware\Models\Article\Article), Object(Shopware\Proxies\_\_CG\_\_\Shopware\Models\Article\Detail), Object(Shopware\Models\Tax\Tax)) #2 D:\Documents\Projects\BigPicture\Skateshop\shop\engine\Shopware\Components\Api\Resource\Variant.php(374): Shopware\Components\Api\Resource\Variant-\>prepareData(Array, Object(Shopware\Models\Article\Article), Object(Shopware\Proxies\_\_CG\_\_\Shopware\Models\Article\Detail)) #3 D:\Documents\Projects\BigPicture\Skateshop\shop\engine\Shopware\Components\Api\Resource\Article.php(761): Shopware\Components\Api\Resource\Variant-\>prepareMainVariantData(Array, Object(Shopware\Models\Article\Article), Object(Shopware\Proxies\_\_CG\_\_\Shopware\Models\Article\Detail)) #4 D:\Documents\Projects\BigPicture\Skateshop\shop\engine\Shopware\Components\Api\Resource\Article.php(738): Shopware\Components\Api\Resource\Article-\>prepareMainDetail(Array, Object(Shopware\Models\Article\Article)) #5 D:\Documents\Projects\BigPicture\Skateshop\shop\engine\Shopware\Components\Api\Resource\Article.php(611): Shopware\Components\Api\Resource\Article-\>prepareAssociatedData(Array, Object(Shopware\Models\Article\Article)) #6 D:\Documents\Projects\BigPicture\Skateshop\shop\engine\Shopware\Controllers\Api\Articles.php(116): Shopware\Components\Api\Resource\Article-\>update('185', Array) #7 D:\Documents\Projects\BigPicture\Skateshop\shop\engine\Library\Enlight\Controller\Action.php(159): Shopware\_Controllers\_Api\_Articles-\>putAction() #8 D:\Documents\Projects\BigPicture\Skateshop\shop\engine\Library\Enlight\Controller\Dispatcher\Default.php(524): Enlight\_Controller\_Action-\>dispatch('putAction') #9 D:\Documents\Projects\BigPicture\Skateshop\shop\engine\Library\Enlight\Controller\Front.php(227): Enlight\_Controller\_Dispatcher\_Default-\>dispatch(Object(Enlight\_Controller\_Request\_RequestHttp), Object(Enlight\_Controller\_Response\_ResponseHttp)) #10 D:\Documents\Projects\BigPicture\Skateshop\shop\engine\Shopware\Kernel.php(143): Enlight\_Controller\_Front-\>dispatch() #11 D:\Documents\Projects\BigPicture\Skateshop\shop\vendor\symfony\http-kernel\Symfony\Component\HttpKernel\HttpCache\HttpCache.php(490): Shopware\Kernel-\>handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #12 D:\Documents\Projects\BigPicture\Skateshop\shop\engine\Shopware\Components\HttpCache\AppCache.php(255): Symfony\Component\HttpKernel\HttpCache\HttpCache-\>forward(Object(Symfony\Component\HttpFoundation\Request), true, NULL) #13 D:\Documents\Projects\BigPicture\Skateshop\shop\vendor\symfony\http-kernel\Symfony\Component\HttpKernel\HttpCache\HttpCache.php(261): Shopware\Components\HttpCache\AppCache-\>forward(Object(Symfony\Component\HttpFoundation\Request), true) #14 D:\Documents\Projects\BigPicture\Skateshop\shop\vendor\symfony\http-kernel\Symfony\Component\HttpKernel\HttpCache\HttpCache.php(278): Symfony\Component\HttpKernel\HttpCache\HttpCache-\>pass(Object(Symfony\Component\HttpFoundation\Request), true) #15 D:\Documents\Projects\BigPicture\Skateshop\shop\engine\Shopware\Components\HttpCache\AppCache.php(133): Symfony\Component\HttpKernel\HttpCache\HttpCache-\>invalidate(Object(Symfony\Component\HttpFoundation\Request), true) #16 D:\Documents\Projects\BigPicture\Skateshop\shop\vendor\symfony\http-kernel\Symfony\Component\HttpKernel\HttpCache\HttpCache.php(207): Shopware\Components\HttpCache\AppCache-\>invalidate(Object(Symfony\Component\HttpFoundation\Request), true) #17 D:\Documents\Projects\BigPicture\Skateshop\shop\engine\Shopware\Components\HttpCache\AppCache.php(114): Symfony\Component\HttpKernel\HttpCache\HttpCache-\>handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #18 D:\Documents\Projects\BigPicture\Skateshop\shop\shopware.php(101): Shopware\Components\HttpCache\AppCache-\>handle(Object(Symfony\Component\HttpFoundation\Request)) #19 {main} [] {"uid":"0133a51"}