$feedId =
$params['id'
] ?? null;
if (!
empty($feedId)) { // Edit Product Feed
/** @var ProductFeed $productFeed */
$productFeed =
$this->
get('models'
)->
getRepository(ProductFeed::
class)->
find($feedId);
// Clear all previous associations
$productFeed->
getCategories()->
clear();
$productFeed->
getSuppliers()->
clear();
$productFeed->
getArticles()->
clear();
} else { // New Product Feed
$productFeed =
new ProductFeed();
// To set this value initial
$productFeed->
setLastExport('now'
);
} if (empty($params['shopId'
])) { $params['shopId'
] = null;
} if (empty($params['categoryId'
])) { $params['categoryId'
] = null;
} if (empty($params['customerGroupId'
])) {