protected function persistCompetencyProgress(User $user, Competency $competency) { $progress = new CompetencyProgress(); $progress->setUser($user); $progress->setCompetency($competency); $this->om->persist($progress); return $progress; }
private function getCompetencyProgress(Competency $competency, User $user) { if (!isset($this->cachedCompetencyProgresses[$competency->getId()])) { $progress = $this->competencyProgressRepo->findOneBy(['competency' => $competency, 'user' => $user]); if (!$progress) { $progress = new CompetencyProgress(); $progress->setCompetency($competency); $progress->setUser($user); $this->om->persist($progress); } else { $this->om->persist($progress->makeLog()); } $this->cachedCompetencyProgresses[$competency->getId()] = $progress; } return $this->cachedCompetencyProgresses[$competency->getId()]; }