Show a treeview in the admin menus, to select between the different elements.

This commit is contained in:
Jan Böhmer 2019-04-05 17:49:02 +02:00
parent 928b574d8c
commit 650b388a1d
16 changed files with 269 additions and 25 deletions

View file

@ -91,7 +91,7 @@ class Attachment extends NamedDBElement
*
* @return DBElement The associated Element.
*/
public function getElement(): AttachmentContainingDBElement
public function getElement(): ?AttachmentContainingDBElement
{
return $this->element;
}

View file

@ -23,6 +23,7 @@ declare(strict_types=1);
namespace App\Entity;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
@ -33,9 +34,9 @@ abstract class AttachmentContainingDBElement extends NamedDBElement
/**
* @var
* //TODO
* //@ORM\OneToMany(targetEntity="Attachment", mappedBy="element")
* @ORM\OneToMany(targetEntity="Attachment", mappedBy="element")
*/
protected $attachment;
protected $attachments;
//TODO
protected $attachmentTypes;
@ -54,7 +55,7 @@ abstract class AttachmentContainingDBElement extends NamedDBElement
*
* @throws Exception if there was an error
*/
public function getAttachmentTypes(): array
public function getAttachmentTypes(): ?array
{
return $this->attachmentTypes;
}
@ -70,7 +71,7 @@ abstract class AttachmentContainingDBElement extends NamedDBElement
*
* @throws Exception if there was an error
*/
public function getAttachments($type_id = null, bool $only_table_attachements = false): array
public function getAttachments($type_id = null, bool $only_table_attachements = false) : Collection
{
if ($only_table_attachements || $type_id) {
$attachements = $this->attachments;

View file

@ -25,6 +25,7 @@ namespace App\Entity;
use App\Validator\Constraints\NoneOfItsChildren;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
@ -58,7 +59,7 @@ class AttachmentType extends StructuralDBElement
* @return Attachment[] all attachements with this type, as a one-dimensional array of Attachement-objects
* (sorted by their names)
*/
public function getAttachementsForType(): ArrayCollection
public function getAttachementsForType(): Collection
{
// the attribute $this->attachements is used from class "AttachementsContainingDBELement"
if (null === $this->attachments) {