Added admin pages for manufacturers and suppliers.

This commit is contained in:
Jan Böhmer 2019-04-26 19:12:48 +02:00
parent df0a8254bf
commit 4e9cbdffed
9 changed files with 383 additions and 6 deletions

View file

@ -32,8 +32,10 @@ namespace App\Services;
use App\Entity\AttachmentType;
use App\Entity\Category;
use App\Entity\Device;
use App\Entity\Manufacturer;
use App\Entity\NamedDBElement;
use App\Entity\Part;
use App\Entity\Supplier;
use App\Exceptions\EntityNotSupported;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
@ -123,6 +125,14 @@ class EntityURLGenerator
return $this->urlGenerator->generate("device_edit", ['id' => $entity->getID()]);
}
if ($entity instanceof Supplier) {
return $this->urlGenerator->generate("supplier_edit", ['id' => $entity->getID()]);
}
if ($entity instanceof Manufacturer) {
return $this->urlGenerator->generate("manufacturer_edit", ['id' => $entity->getID()]);
}
//Otherwise throw an error
throw new EntityNotSupported('The given entity is not supported yet!');
}
@ -152,6 +162,14 @@ class EntityURLGenerator
return $this->urlGenerator->generate('device_new');
}
if ($entity instanceof Supplier) {
return $this->urlGenerator->generate('supplier_new');
}
if ($entity instanceof Manufacturer) {
return $this->urlGenerator->generate('manufacturer_new');
}
throw new EntityNotSupported('The given entity is not supported yet!');
}
@ -202,6 +220,14 @@ class EntityURLGenerator
return $this->urlGenerator->generate('device_delete', ['id' => $entity->getID()]);
}
if ($entity instanceof Supplier) {
return $this->urlGenerator->generate('supplier_delete', ['id' => $entity->getID()]);
}
if ($entity instanceof Manufacturer) {
return $this->urlGenerator->generate('manufacturer_new', ['id' => $entity->getID()]);
}
throw new EntityNotSupported('The given entity is not supported yet!');
}