You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the expected outcome of your requested feature
To access product accessories, we currently use ProductAccessoryFacade (resp. ProductAccessoryRepository). It is not possible to access the accessories directly from a product. In ProductDataFactory, there is the following code:
protected function getAccessoriesData(Product $product)
{
$productAccessoriesByPosition = [];
foreach ($this->productAccessoryRepository->getAllByProduct($product) as $productAccessory) {
$productAccessoriesByPosition[$productAccessory->getPosition()] = $productAccessory->getAccessory();
}
return $productAccessoriesByPosition;
}
It seems like all of that is unnecessary, as we can do the following changes:
initialize and set the relation in Product::setData() method:
$this->productAccessories = new ArrayCollection($productData->accessories);
Btw in ProductFacade, there is quite a complicated method refreshProductAccessories that is called in create and edit methods. I am not sure, maybe this one can be removed as well
The text was updated successfully, but these errors were encountered:
Describe the expected outcome of your requested feature
To access product accessories, we currently use
ProductAccessoryFacade
(resp.ProductAccessoryRepository
). It is not possible to access the accessories directly from a product. InProductDataFactory
, there is the following code:It seems like all of that is unnecessary, as we can do the following changes:
Product
:ProductAccessory::$product
:Product::setData()
method:Btw in
ProductFacade
, there is quite a complicated methodrefreshProductAccessories
that is called increate
andedit
methods. I am not sure, maybe this one can be removed as wellThe text was updated successfully, but these errors were encountered: