/**
  * @param integer $limit
  * @return void
  */
 public function listAction($limit = 100)
 {
     $this->view->assign('initSyncDeployment', new InitSyncDeployment());
     $this->view->assign('syncDeployment', new SyncDeployment());
     $this->view->assign('gitRepositoryDeployment', new GitRepositoryDeployment());
     $copyDeployment = new CopyDeployment();
     $copyDeployment->setGitRepositoryDeployment(new GitRepositoryDeployment());
     $copyDeployment->setInitSyncDeployment(new InitSyncDeployment());
     $this->view->assign('copyDeployment', $copyDeployment);
     $this->view->assign('deployments', $this->deploymentRepository->findAllWithLimit($limit));
 }
 /**
  * @param \Lightwerk\SurfCaptain\Domain\Facet\Deployment\CopyDeployment
  * @return \Lightwerk\SurfCaptain\Domain\Model\Deployment
  * @throws \Lightwerk\SurfCaptain\Domain\Repository\Preset\Exception
  * @throws \Lightwerk\SurfCaptain\GitApi\Exception
  */
 public function createFromCopyDeployment(CopyDeployment $copyDeployment)
 {
     $gitRepositoryDeployment = $copyDeployment->getGitRepositoryDeployment();
     $initSyncDeployment = $copyDeployment->getInitSyncDeployment();
     $gitRepositoryDeployment->setPresetKey($copyDeployment->getPresetKey());
     $initSyncDeployment->setPresetKey($copyDeployment->getPresetKey());
     $gitRepositoryConfiguration = $this->createFromGitRepositoryDeployment($gitRepositoryDeployment)->getConfiguration();
     $syncConfiguration = $this->createFromInitSyncDeployment($initSyncDeployment)->getConfiguration();
     $preset = \TYPO3\Flow\Utility\Arrays::arrayMergeRecursiveOverrule($syncConfiguration, $gitRepositoryConfiguration);
     $postset = array();
     $postset['applications'][0]['type'] = $copyDeployment->getDeploymentType();
     $configuration = \TYPO3\Flow\Utility\Arrays::arrayMergeRecursiveOverrule($preset, $postset);
     return $this->createFromConfiguration($configuration);
 }
 /**
  * @param string $presetKey 
  * @param string $type
  * @return void
  */
 public function createCopyDeploymentCommand($sourcePresetKey, $targetPresetKey)
 {
     $initSyncDeployment = new InitSyncDeployment();
     $initSyncDeployment->setSourcePresetKey($sourcePresetKey);
     $gitRepositoryDeployment = new GitRepositoryDeployment();
     $copyDeployment = new CopyDeployment();
     $copyDeployment->setPresetKey($targetPresetKey);
     $copyDeployment->setInitSyncDeployment($initSyncDeployment);
     $copyDeployment->setGitRepositoryDeployment($gitRepositoryDeployment);
     try {
         $deployment = $this->deploymentFactory->createFromCopyDeployment($copyDeployment);
         $this->deploymentRepository->add($deployment);
         $this->outputLine('OK: deployment added');
     } catch (\Lightwerk\SurfCaptain\Exception $e) {
         $this->outputLine('ERROR: ' . $e->getMessage() . ' - ' . $e->getCode());
     } catch (\TYPO3\Flow\Http\Exception $e) {
         $this->outputLine('ERROR: ' . $e->getMessage() . ' - ' . $e->getCode());
     }
 }