first commit: rendez-vous menu entry deleted from task usermenubuilder. Start sous-types

This commit is contained in:
Julie Lenaerts 2021-09-17 17:00:23 +02:00
parent 951d686366
commit 601c16ac27
3 changed files with 69 additions and 12 deletions

View File

@ -4,7 +4,6 @@ declare(strict_types=1);
namespace Chill\AsideActivityBundle\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
@ -21,6 +20,16 @@ class AsideActivityCategory
*/
private int $id;
/**
* @ORM\ManyToOne(targetEntity=AsideActivityCategory::class, inversedBy="children")
*/
private $parent;
/**
* @ORM\ManyToOne(targetEntity=AsideActivityCategory::class, mappedBy="parent")
*/
private $children;
/**
* @ORM\Column(type="json", length=255)
*/
@ -59,4 +68,52 @@ class AsideActivityCategory
return $this;
}
public function getParent(): ?self
{
return $this->parent;
}
public function hasParent(): bool
{
return $this->parent !== null;
}
public function setParent(?self $parent): self
{
$this->parent = $parent;
return $this;
}
/**
* @return Collection|self[]
*/
public function getChildren(): Collection
{
return $this->children;
}
public function addChild(self $child): self
{
if (!$this->children->contains($child)) {
$this->children[] = $child;
$child->setParent($this);
}
return $this;
}
public function removeChild(self $child): self
{
if ($this->children->removeElement($child)) {
// set the owning side to null (unless already changed)
if ($child->getParent() === $this) {
$child->setParent(null);
}
}
return $this;
}
}

View File

@ -1,5 +1,5 @@
services:
Chill\AsideActivityBundle\Menu\:
resource: './../../Menu'
resource: "./../../Menu"
autowire: true
autoconfigure: true

View File

@ -115,16 +115,16 @@ class UserMenuBuilder implements LocalMenuBuilderInterface
'icon' => 'tasks'
]);
$menu->addChild("My calendar list", [
'route' => 'chill_calendar_calendar_list',
'routeParameters' => [
'user_id' => $user->getId(),
]
])
->setExtras([
'order' => -9,
'icon' => 'tasks'
]);
// $menu->addChild("My calendar list", [
// 'route' => 'chill_calendar_calendar_list',
// 'routeParameters' => [
// 'user_id' => $user->getId(),
// ]
// ])
// ->setExtras([
// 'order' => -9,
// 'icon' => 'tasks'
// ]);
/*
$menu->addChild("My aside activities", [