Esempio n. 1
0
 protected function getRepoOrCreateIt(User $owner, $name)
 {
     if (($repo = $this->getContainer()->get("doctrine")->getManager()->getRepository("AppBundle:Repository")->findOneBy(["owner" => $owner, "name" => $name])) == null) {
         $repo = new Repository();
         $repo->setOwner($owner);
         $repo->setName($name);
     }
     return $repo;
 }
Esempio n. 2
0
 protected function retrieveOrCreateRepository(User $owner, $name)
 {
     $repository = $this->entityManager->getRepository("AppBundle:Repository")->findOneBy(["owner" => $owner, "name" => $name]);
     if ($repository == null) {
         $repository = new Repository();
         $repository->setOwner($owner);
         $repository->setName($name);
     }
     return $repository;
 }