protected function getACLOrCreateIt(User $user, Repository $repository) { if (($repoACL = $this->getContainer()->get("doctrine")->getManager()->getRepository("AppBundle:RepositoryACL")->findOneBy(["user" => $user, "repository" => $repository])) == null) { $repoACL = new RepositoryACL(); $repoACL->setUser($user); $repoACL->setRepository($repository); } return $repoACL; }
/** * Retrieve or create the repository acl * * @param User $user * @param Repository $repository * @return RepositoryACL */ protected function retrieveOrCreateRepositoryACL(User $user, Repository $repository) { $repositoryACL = $this->entityManager->getRepository("AppBundle:RepositoryACL")->findOneBy(["user" => $user, "repository" => $repository]); if ($repositoryACL == null) { $repositoryACL = new RepositoryACL(); $repositoryACL->setUser($user); $repositoryACL->setRepository($repository); } return $repositoryACL; }