public function getUser() { if ($this->user !== null) { return $this->user; } $entityManager = $this->doctrineBoot->getEntityManager(); if (!isset($_SESSION['user'])) { return null; } $this->user = $entityManager->find(User::class, $_SESSION['user']); return $this->user; }
public function afterDeprovisioning($instanceId) { $em = $this->doctrineBoot->getEntityManager(); $repoServiceInstance = $em->getRepository(ServiceInstance::class); $serviceInstance = $repoServiceInstance->find($instanceId); if ($serviceInstance === null) { $this->responseGone(); return null; } $em->remove($serviceInstance); $this->responseOk(); return $serviceInstance; }
public function createDashboard(array $dashboard) { $em = $this->doctrineBoot->getEntityManager(); $repo = $em->getRepository(Dashboard::class); $dashboardObject = $repo->find($dashboard['id']); if ($dashboardObject !== null) { $dashboardObject->setSecret($dashboard['secret']); $dashboardObject->setRedirectUri($dashboard['redirect_uri']); return $dashboardObject; } $dashboardObject = new Dashboard($dashboard['id'], $dashboard['secret'], $dashboard['redirect_uri']); $em->persist($dashboardObject); return $dashboardObject; }
/** * @param DoctrineBoot $doctrineBoot */ public function setDoctrineBoot(DoctrineBoot $doctrineBoot) { $this->doctrineBoot = $doctrineBoot; $this->entityManager = $doctrineBoot->getEntityManager(); }