Refactored Admin Page controllers a bit...

This commit is contained in:
Jan Böhmer 2020-06-07 21:11:09 +02:00
parent e7e73602a0
commit a8786341d5
5 changed files with 190 additions and 96 deletions

View file

@ -43,6 +43,7 @@ declare(strict_types=1);
namespace App\Controller\AdminPages;
use App\Entity\Attachments\CurrencyAttachment;
use App\Entity\Base\AbstractNamedDBElement;
use App\Entity\Parameters\CurrencyParameter;
use App\Entity\PriceInformations\Currency;
use App\Form\AdminPages\CurrencyAdminForm;
@ -121,4 +122,16 @@ class CurrencyController extends BaseAdminController
{
return $this->_exportEntity($entity, $exporter, $request);
}
public function deleteCheck(AbstractNamedDBElement $entity): bool
{
if ($entity instanceof Currency) {
if ($entity->getPricedetails()->count() > 0) {
$this->addFlash('error', 'entity.delete.must_not_contain_prices');
return false;
}
}
return true;
}
}