40 lines
1.0 KiB
PHP
40 lines
1.0 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 RemoveLabelsRelationAction 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_relations', 'Label');
|
|
}
|
|
|
|
public function execute(&$data, array $config, string $type): ActionResult
|
|
{
|
|
$result = $this->productLabelUtil->removeProductLabelRelationsByAutoAssignment($this->getID());
|
|
|
|
return new ActionResult(true, "Dokončeno. Počet smazaných přiřazení: {$result}");
|
|
}
|
|
}
|