Files
kupshop/bundles/KupShop/LabelsBundle/Admin/Actions/RemoveLabelsManualRelationAction.php
2025-08-02 16:30:27 +02:00

40 lines
1.1 KiB
PHP

<?php
declare(strict_types=1);
namespace KupShop\LabelsBundle\Admin\Actions;
use KupShop\AdminBundle\Admin\Actions\AbstractAction;
use KupShop\AdminBundle\Admin\Actions\ActionResult;
use KupShop\AdminBundle\Admin\Actions\IAction;
use KupShop\LabelsBundle\Util\ProductLabelUtil;
use Symfony\Contracts\Service\Attribute\Required;
class RemoveLabelsManualRelationAction extends AbstractAction implements IAction
{
#[Required]
public ProductLabelUtil $productLabelUtil;
public function getTypes(): array
{
return ['Label'];
}
public function getIcon(): string
{
return 'glyphicon glyphicon-remove';
}
public function getName(): string
{
return translate('remove_labels_manual_relations', 'Label');
}
public function execute(&$data, array $config, string $type): ActionResult
{
$result = $this->productLabelUtil->removeProductLabelRelationsByManualAssignment($this->getID());
return new ActionResult(true, "Dokončeno odebrání manuálně odebraných štítků. Počet smazaných přiřazení: {$result}");
}
}