mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-23 18:28:49 +02:00
Refactored Admin Page controllers a bit...
This commit is contained in:
parent
e7e73602a0
commit
a8786341d5
5 changed files with 190 additions and 96 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue