Esempio n. 1
0
 public function createAction(Application $app, Request $request)
 {
     $remote = new Remote();
     $remote->setName($request->get('name'));
     $remote->setAdapter($request->get('adapter'));
     $remote->setEnabled($request->get('enabled', false));
     /** @var \Terramar\Packages\Helper\PluginHelper $helper */
     $helper = $app->get('packages.helper.plugin');
     $request->request->set('remote', $remote);
     $helper->invokeAction($request, Actions::REMOTE_CREATE, $request->request->all());
     /** @var \Doctrine\ORM\EntityManager $entityManager */
     $entityManager = $app->get('doctrine.orm.entity_manager');
     $entityManager->persist($remote);
     $entityManager->flush();
     return new RedirectResponse($app->get('router.url_generator')->generate('manage_remotes'));
 }
Esempio n. 2
0
 /**
  * @param Remote $remote
  *
  * @return bool
  */
 public function supports(Remote $remote)
 {
     return $remote->getAdapter() === $this->getName();
 }