Beispiel #1
0
 /**
  * @param Project $project
  *
  * @return boolean
  */
 protected function doBranches(Project $project)
 {
     foreach ($this->provider->getBranches($project) as $name) {
         $branch = new Branch();
         $branch->setName($name);
         $branch->setProject($project);
         $project->addBranch($branch);
     }
     return true;
 }
Beispiel #2
0
 /**
  * @param Request $request
  * @param string  $providerName
  *
  * @return Response
  */
 private function handleOAuthCallbackAuthenticated(Request $request, User $user, ProviderInterface $provider)
 {
     try {
         $provider->handleOAuthCallback($request, $user);
         $manager = $this->get('fos_user.user_manager');
         $manager->updateUser($user);
     } catch (ProviderException $e) {
         return $this->render('AppCoreBundle:Import:index.html.twig', ['exception' => $e, 'providers' => $this->container->getParameter('providers')]);
     }
     $session = $request->getSession();
     if (null !== ($redirectUri = $session->get('import/redirect_uri'))) {
         $session->remove('import/redirect_uri');
         return $this->redirect($redirectUri);
     }
     return $this->redirect($this->generateUrl('app_core_import_provider', ['providerName' => $provider->getName()]));
 }
Beispiel #3
0
 /**
  * @param ProviderInterface
  *
  * @return ArrayCollection
  */
 public function getProjectsByProvider(ProviderInterface $provider)
 {
     return $this->getProjects()->filter(function ($project) use($provider) {
         return $project->getProviderName() === $provider->getName();
     });
 }