Added admin page for devices

This commit is contained in:
Jan Böhmer 2019-04-26 18:31:09 +02:00
parent c11d78e52f
commit df0a8254bf
5 changed files with 139 additions and 9 deletions

View file

@ -31,6 +31,7 @@ namespace App\Services;
use App\Entity\AttachmentType;
use App\Entity\Category;
use App\Entity\Device;
use App\Entity\NamedDBElement;
use App\Entity\Part;
use App\Exceptions\EntityNotSupported;
@ -110,12 +111,16 @@ class EntityURLGenerator
return $this->urlGenerator->generate('part_edit', ['id' => $entity->getID()]);
}
if($entity instanceof AttachmentType) {
if ($entity instanceof AttachmentType) {
return $this->urlGenerator->generate('attachment_type_edit', ['id' => $entity->getID()]);
}
if($entity instanceof Category) {
return $this->urlGenerator->generate("category_edit", ['id' => $entity->getID()]);
if ($entity instanceof Category) {
return $this->urlGenerator->generate("category_edit", ['id' => $entity->getID()]);
}
if ($entity instanceof Device) {
return $this->urlGenerator->generate("device_edit", ['id' => $entity->getID()]);
}
//Otherwise throw an error
@ -135,14 +140,18 @@ class EntityURLGenerator
return $this->urlGenerator->generate('part_new');
}
if($entity instanceof AttachmentType) {
if ($entity instanceof AttachmentType) {
return $this->urlGenerator->generate('attachment_type_new');
}
if($entity instanceof Category) {
if ($entity instanceof Category) {
return $this->urlGenerator->generate('category_new');
}
if ($entity instanceof Device) {
return $this->urlGenerator->generate('device_new');
}
throw new EntityNotSupported('The given entity is not supported yet!');
}
@ -181,14 +190,18 @@ class EntityURLGenerator
public function deleteURL($entity) : string
{
if($entity instanceof AttachmentType) {
if ($entity instanceof AttachmentType) {
return $this->urlGenerator->generate('attachment_type_delete', ['id' => $entity->getID()]);
}
if($entity instanceof Category) {
if ($entity instanceof Category) {
return $this->urlGenerator->generate('category_delete', ['id' => $entity->getID()]);
}
if ($entity instanceof Device) {
return $this->urlGenerator->generate('device_delete', ['id' => $entity->getID()]);
}
throw new EntityNotSupported('The given entity is not supported yet!');
}