public function __construct(Dashboard $dashboard) { $this->id = $dashboard->getId(); $this->creationDate = $dashboard->getCreationDate(); $this->name = $dashboard->getName(); $this->gadgetContainer = new GadgetContainerEntity($dashboard->getGadgetContainer()); }
public function getAccountDashboard(AccountInterface $account) { $dashboard = null; $dashboardId = $account->getProperty('dashboard'); if ($dashboardId) { $repository = $this->entityManager->getRepository(DashboardEntity::class); $dashboard = $repository->find($dashboardId); } if (!$dashboard) { $dashboard = new DashboardEntity('Dashboard ' . $account->getContact()->getDisplayName()); $account->setProperty('dashboard', $dashboard->getId()->toString()); $this->entityManager->persist($dashboard); $this->entityManager->flush(); } return $dashboard; }