Elcodi\Admin\CurrencyBundle\Controller\CurrencyController::disableCurrencyAction PHP Метод

disableCurrencyAction() публичный Метод

Disable entity
public disableCurrencyAction ( Elcodi\Component\Currency\Entity\Interfaces\CurrencyInterface $currency ) : array
$currency Elcodi\Component\Currency\Entity\Interfaces\CurrencyInterface The currency to disable
Результат array Result
    public function disableCurrencyAction(CurrencyInterface $currency)
    {
        $translator = $this->get('translator');
        /**
         * We cannot disable the default currency
         */
        $masterCurrency = $configManager = $this->get('elcodi.store')->getDefaultCurrency();
        if ($currency->getIso() == $masterCurrency) {
            throw new HttpException('403', $translator->trans('admin.currency.error.disable_master_currency'));
        }
        $this->disableEntity($currency);
        return ['message' => $translator->trans('admin.currency.saved.disabled')];
    }