<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass="App\Repository\DashboardRepository")
*/
class Dashboard
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\OneToOne(targetEntity="App\Entity\User", inversedBy="dashboard")
*/
private $user;
/**
* @ORM\OneToMany(targetEntity="App\Entity\DashboardWidget", mappedBy="dashboard")
*/
private $dashboardWidgets;
public function __construct()
{
$this->dashboardWidgets = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
/**
* @return mixed
*/
public function getUser()
{
return $this->user;
}
/**
* @param mixed $user
*/
public function setUser($user): void
{
$this->user = $user;
}
/**
* @return Collection|DashboardTemplate[]
*/
public function getDashboardWidgets(): Collection
{
return $this->dashboardWidgets;
}
public function addDashboardWidget(DashboardWidget $dashboardWidget): self
{
if (!$this->dashboardWidgets->contains($dashboardWidget)) {
$this->dashboardWidgets->add($dashboardWidget);
$dashboardWidget->setDashboard($this);
}
return $this;
}
public function removeDashboardWidget(DashboardWidget $dashboardWidget): self
{
if ($this->dashboardWidgets->contains($dashboardWidget)) {
$this->dashboardWidgets->removeElement($dashboardWidget);
}
return $this;
}
}