From b99ded3e93af92eeb6f48aefe552ec5c7bdc2527 Mon Sep 17 00:00:00 2001 From: Paul Schweppe Date: Wed, 5 Oct 2016 16:00:36 +0100 Subject: [PATCH 01/60] Update Forms for symfony 3.0 --- .../Admin/IssueLabelAdminController.php | 8 +++++--- .../Controller/Issues/IssueController.php | 11 ++++++----- .../Controller/Issues/IssueLabelController.php | 5 +++-- .../Issues/IssueMilestoneController.php | 7 ++++--- .../Controller/ProjectBranchController.php | 5 +++-- .../Controller/ProjectCommitController.php | 6 +----- .../Controller/ProjectController.php | 7 ++++--- .../Controller/ProjectEnvironmentController.php | 7 ++++--- .../ProjectIssueIntegratorController.php | 4 +++- .../Controller/ProjectRemoteController.php | 6 ++++-- .../Controller/ProjectSyncController.php | 16 +++++++++------- .../Controller/UserManagementController.php | 6 ++++-- .../Controller/UserProjectsController.php | 6 ++++-- .../GitControlBundle/Form/CommitType.php | 14 +++++++------- .../Form/EditUserProjectsType.php | 4 ++-- .../GitControlBundle/Form/EditUserType.php | 2 +- .../Form/Embbed/ProjectEnvironmentEmbbedType.php | 2 +- .../Form/Field/EntityHiddenType.php | 9 ++++++--- .../GitControlBundle/Form/IssueCommentType.php | 8 ++++---- .../GitControlBundle/Form/IssueEditType.php | 8 ++++---- .../GitControlBundle/Form/IssueLabelType.php | 8 ++++---- .../GitControlBundle/Form/IssueMilestoneType.php | 2 +- .../GitControlBundle/Form/IssueType.php | 8 ++++---- .../Form/ProjectEnvironmentFilePermType.php | 2 +- .../Form/ProjectEnvironmentType.php | 2 +- .../Form/ProjectIssueIntegratorType.php | 8 ++++---- .../GitControlBundle/Form/ProjectType.php | 2 +- .../GitControlBundle/Form/RegistrationType.php | 2 +- .../GitControlBundle/Form/UserProjectsType.php | 2 +- 29 files changed, 97 insertions(+), 80 deletions(-) diff --git a/src/VersionControl/GitControlBundle/Controller/Admin/IssueLabelAdminController.php b/src/VersionControl/GitControlBundle/Controller/Admin/IssueLabelAdminController.php index 4c8bdc2..c1802d5 100644 --- a/src/VersionControl/GitControlBundle/Controller/Admin/IssueLabelAdminController.php +++ b/src/VersionControl/GitControlBundle/Controller/Admin/IssueLabelAdminController.php @@ -20,6 +20,8 @@ use VersionControl\GitControlBundle\Form\IssueLabelType; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security; +use Symfony\Component\Form\Extension\Core\Type\SubmitType; + /** * IssueLabel controller. * @@ -87,7 +89,7 @@ private function createCreateForm(IssueLabel $issue) 'method' => 'POST', )); - $form->add('submit', 'submit', array('label' => 'Create')); + $form->add('submit', SubmitType::class, array('label' => 'Create')); return $form; } @@ -155,7 +157,7 @@ private function createEditForm(IssueLabel $issue) 'method' => 'PUT', )); - $form->add('submit', 'submit', array('label' => 'Update')); + $form->add('submit', SubmitType::class, array('label' => 'Update')); return $form; } @@ -230,7 +232,7 @@ private function createDeleteForm($id) return $this->createFormBuilder() ->setAction($this->generateUrl('admin_issuelabel_delete', array('id' => $id))) ->setMethod('DELETE') - ->add('submit', 'submit', array('label' => 'Delete')) + ->add('submit', SubmitType::class, array('label' => 'Delete')) ->getForm() ; } diff --git a/src/VersionControl/GitControlBundle/Controller/Issues/IssueController.php b/src/VersionControl/GitControlBundle/Controller/Issues/IssueController.php index 45d0646..74e2883 100644 --- a/src/VersionControl/GitControlBundle/Controller/Issues/IssueController.php +++ b/src/VersionControl/GitControlBundle/Controller/Issues/IssueController.php @@ -23,6 +23,7 @@ use VersionControl\GitControlBundle\Repository\Issues\IssueRepositoryInterface; use VersionControl\GitControlBundle\Annotation\ProjectAccess; +use Symfony\Component\Form\Extension\Core\Type\SubmitType; /** * Issue controller. @@ -159,7 +160,7 @@ private function createCreateForm(IssueInterface $entity) )); - $form->add('submit', 'submit', array('label' => 'Create')); + $form->add('submit', SubmitType::class, array('label' => 'Create')); return $form; } @@ -255,7 +256,7 @@ private function createEditForm(IssueInterface $entity) 'data_class' => get_class($entity) )); - $form->add('submit', 'submit', array('label' => 'Update')); + $form->add('submit', SubmitType::class, array('label' => 'Update')); return $form; } @@ -399,7 +400,7 @@ private function createDeleteForm($id) return $this->createFormBuilder() ->setAction($this->generateUrl('issue_delete', array('id' => $id))) ->setMethod('DELETE') - ->add('submit', 'submit', array('label' => 'Delete')) + ->add('submit', SubmitType::class, array('label' => 'Delete')) ->getForm() ; } @@ -463,8 +464,8 @@ private function createCommentForm(IssueCommentInteface $entity, $issueId) 'data_class' => get_class($entity), )); - $form->add('create', 'submit', array('label' => 'Create')); - $form->add('createClose', 'submit', array('label' => 'Create & Close')); + $form->add('create', SubmitType::class, array('label' => 'Create')); + $form->add('createClose', SubmitType::class, array('label' => 'Create & Close')); return $form; } diff --git a/src/VersionControl/GitControlBundle/Controller/Issues/IssueLabelController.php b/src/VersionControl/GitControlBundle/Controller/Issues/IssueLabelController.php index 0a3fec1..2886ebb 100644 --- a/src/VersionControl/GitControlBundle/Controller/Issues/IssueLabelController.php +++ b/src/VersionControl/GitControlBundle/Controller/Issues/IssueLabelController.php @@ -18,6 +18,7 @@ use VersionControl\GitControlBundle\Entity\Issues\IssueLabelInterface; use VersionControl\GitControlBundle\Form\IssueLabelType; use VersionControl\GitControlBundle\Annotation\ProjectAccess; +use Symfony\Component\Form\Extension\Core\Type\SubmitType; /** * IssueLabel controller. @@ -102,7 +103,7 @@ private function createCreateForm(IssueLabelInterface $issueLabel) 'method' => 'POST', )); - $form->add('submit', 'submit', array('label' => 'Create')); + $form->add('submit', SubmitType::class, array('label' => 'Create')); return $form; } @@ -169,7 +170,7 @@ private function createEditForm(IssueLabelInterface $issue) 'method' => 'PUT', )); - $form->add('submit', 'submit', array('label' => 'Update')); + $form->add('submit', SubmitType::class, array('label' => 'Update')); return $form; } diff --git a/src/VersionControl/GitControlBundle/Controller/Issues/IssueMilestoneController.php b/src/VersionControl/GitControlBundle/Controller/Issues/IssueMilestoneController.php index aeb90a6..d3ec4a1 100644 --- a/src/VersionControl/GitControlBundle/Controller/Issues/IssueMilestoneController.php +++ b/src/VersionControl/GitControlBundle/Controller/Issues/IssueMilestoneController.php @@ -16,6 +16,7 @@ use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; use VersionControl\GitControlBundle\Entity\Issues\IssueMilestoneInterface; use VersionControl\GitControlBundle\Annotation\ProjectAccess; +use Symfony\Component\Form\Extension\Core\Type\SubmitType; /** * IssueMilestone controller. @@ -118,7 +119,7 @@ private function createCreateForm(IssueMilestoneInterface $entity) 'method' => 'POST', )); - $form->add('submit', 'submit', array('label' => 'Create')); + $form->add('submit', SubmitType::class, array('label' => 'Create')); return $form; } @@ -220,7 +221,7 @@ private function createEditForm(IssueMilestoneInterface $entity) 'method' => 'PUT', )); - $form->add('submit', 'submit', array('label' => 'Update')); + $form->add('submit', SubmitType::class, array('label' => 'Update')); return $form; } @@ -295,7 +296,7 @@ private function createDeleteForm($id) return $this->createFormBuilder() ->setAction($this->generateUrl('issuemilestone_delete', array('id' => $this->project->getId(),'milestoneId'=>$id))) ->setMethod('DELETE') - ->add('submit', 'submit', array('label' => 'Delete')) + ->add('submit', SubmitType::class, array('label' => 'Delete')) ->getForm() ; } diff --git a/src/VersionControl/GitControlBundle/Controller/ProjectBranchController.php b/src/VersionControl/GitControlBundle/Controller/ProjectBranchController.php index d03077e..b7a7b0a 100644 --- a/src/VersionControl/GitControlBundle/Controller/ProjectBranchController.php +++ b/src/VersionControl/GitControlBundle/Controller/ProjectBranchController.php @@ -21,6 +21,7 @@ use Symfony\Component\Security\Core\Exception\AccessDeniedException; use Symfony\Component\HttpFoundation\Request; use VersionControl\GitControlBundle\Annotation\ProjectAccess; +use Symfony\Component\Form\Extension\Core\Type\SubmitType; /** * Project controller. @@ -256,7 +257,7 @@ private function createNewBranchForm($project, $defaultData = array(), $formActi ) ->getForm(); - $form->add('submit', 'submit', array('label' => 'Create')); + $form->add('submit', SubmitType::class, array('label' => 'Create')); return $form; } @@ -318,7 +319,7 @@ private function createMergeBranchForm($project, $branches, $formAction = 'proje ) ->getForm(); - $form->add('submit', 'submit', array('label' => 'Merge')); + $form->add('submit', SubmitType::class, array('label' => 'Merge')); return $form; } diff --git a/src/VersionControl/GitControlBundle/Controller/ProjectCommitController.php b/src/VersionControl/GitControlBundle/Controller/ProjectCommitController.php index 0a304ff..b6b080c 100644 --- a/src/VersionControl/GitControlBundle/Controller/ProjectCommitController.php +++ b/src/VersionControl/GitControlBundle/Controller/ProjectCommitController.php @@ -217,11 +217,7 @@ private function createCommitForm($commitEntity,$fileChoices){ $includeIssues = ($this->issuesCount > 0)?true:false; //$fileChoices = $this->gitCommitCommand->getFilesToCommit(); $gitRemoteVersions = $this->gitSyncCommands->getRemoteVersions(); - - //$form = $this->createForm((new CommitType($includeIssues,$gitRemoteVersions))->setFileChoices($fileChoices), $commitEntity, array( - // 'action' => $this->generateUrl('project_commit'), - // 'method' => 'POST', - //)); + $form = $this->createForm(CommitType::class, $commitEntity, array( 'action' => $this->generateUrl('project_commit'), diff --git a/src/VersionControl/GitControlBundle/Controller/ProjectController.php b/src/VersionControl/GitControlBundle/Controller/ProjectController.php index de74d63..9104ae2 100644 --- a/src/VersionControl/GitControlBundle/Controller/ProjectController.php +++ b/src/VersionControl/GitControlBundle/Controller/ProjectController.php @@ -19,6 +19,7 @@ use VersionControl\GitControlBundle\Utility\GitCommands; use Symfony\Component\Validator\Constraints\NotBlank; use VersionControl\GitControlBundle\Entity\UserProjects; +use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\Security\Core\Exception\AccessDeniedException; @@ -85,7 +86,7 @@ private function createCreateForm(Project $entity) 'method' => 'POST', )); - $form->add('submit', 'submit', array('label' => 'Create')); + $form->add('submit', SubmitType::class, array('label' => 'Create')); return $form; } @@ -153,7 +154,7 @@ private function createEditForm(Project $entity) 'method' => 'PUT', )); - $form->add('submit', 'submit', array('label' => 'Update')); + $form->add('submit', SubmitType::class, array('label' => 'Update')); return $form; } @@ -235,7 +236,7 @@ private function createDeleteForm($id) return $this->createFormBuilder() ->setAction($this->generateUrl('project_delete', array('id' => $id))) ->setMethod('DELETE') - ->add('submit', 'submit', array('label' => 'Delete')) + ->add('submit', SubmitType::class, array('label' => 'Delete')) ->getForm() ; } diff --git a/src/VersionControl/GitControlBundle/Controller/ProjectEnvironmentController.php b/src/VersionControl/GitControlBundle/Controller/ProjectEnvironmentController.php index 7c10832..b971eb3 100644 --- a/src/VersionControl/GitControlBundle/Controller/ProjectEnvironmentController.php +++ b/src/VersionControl/GitControlBundle/Controller/ProjectEnvironmentController.php @@ -25,6 +25,7 @@ use Symfony\Component\Security\Core\Exception\AccessDeniedException; use VersionControl\GitControlBundle\Annotation\ProjectAccess; +use Symfony\Component\Form\Extension\Core\Type\SubmitType; /** * Project controller. * @@ -135,7 +136,7 @@ private function createCreateForm(ProjectEnvironment $entity,$project,$gitaction 'data'=>$gitaction )); - $form->add('submit', 'submit', array('label' => 'Create')); + $form->add('submit', SubmitType::class, array('label' => 'Create')); return $form; } @@ -248,7 +249,7 @@ private function createEditForm(ProjectEnvironment $entity) 'method' => 'PUT', )); - $form->add('submit', 'submit', array('label' => 'Update')); + $form->add('submit', SubmitType::class, array('label' => 'Update')); return $form; } @@ -328,7 +329,7 @@ private function createDeleteForm($projectEnvironmentId) return $this->createFormBuilder() ->setAction($this->generateUrl('projectenvironment_delete', array('projectEnvironmentId' => $projectEnvironmentId))) ->setMethod('DELETE') - ->add('submit', 'submit', array('label' => 'Delete')) + ->add('submit', SubmitType::class, array('label' => 'Delete')) ->getForm() ; } diff --git a/src/VersionControl/GitControlBundle/Controller/ProjectIssueIntegratorController.php b/src/VersionControl/GitControlBundle/Controller/ProjectIssueIntegratorController.php index 3f0d731..3faa2c3 100644 --- a/src/VersionControl/GitControlBundle/Controller/ProjectIssueIntegratorController.php +++ b/src/VersionControl/GitControlBundle/Controller/ProjectIssueIntegratorController.php @@ -25,6 +25,8 @@ use VersionControl\GitControlBundle\Annotation\ProjectAccess; +use Symfony\Component\Form\Extension\Core\Type\SubmitType; + /** * Project controller. * @@ -83,7 +85,7 @@ private function createDeleteForm($integratorId) return $this->createFormBuilder() ->setAction($this->generateUrl('project_issue_integrator_delete', array('integratorId' => $integratorId))) ->setMethod('DELETE') - ->add('submit', 'submit', array('label' => 'Delete')) + ->add('submit', SubmitType::class, array('label' => 'Delete')) ->getForm() ; } diff --git a/src/VersionControl/GitControlBundle/Controller/ProjectRemoteController.php b/src/VersionControl/GitControlBundle/Controller/ProjectRemoteController.php index c80e505..438454d 100644 --- a/src/VersionControl/GitControlBundle/Controller/ProjectRemoteController.php +++ b/src/VersionControl/GitControlBundle/Controller/ProjectRemoteController.php @@ -24,6 +24,8 @@ use Symfony\Component\HttpFoundation\Request; /** ///Route("/example", service="example_bundle.controller.example_controller") */ use VersionControl\GitControlBundle\Annotation\ProjectAccess; + +use Symfony\Component\Form\Extension\Core\Type\SubmitType; /** * Project controller. * @@ -243,7 +245,7 @@ private function createRemoteForm(){ ,'constraints' => array( new NotBlank() )) - )->add('submit', 'submit', array('label' => 'Add')) + )->add('submit', SubmitType::class, array('label' => 'Add')) ->getForm(); @@ -268,7 +270,7 @@ private function createRenameRemoteForm($defaultData = array()){ ,'constraints' => array( new NotBlank() )) - )->add('submit', 'submit', array('label' => 'Rename')) + )->add('submit', SubmitType::class, array('label' => 'Rename')) ->getForm(); diff --git a/src/VersionControl/GitControlBundle/Controller/ProjectSyncController.php b/src/VersionControl/GitControlBundle/Controller/ProjectSyncController.php index 504a17f..5eb4870 100644 --- a/src/VersionControl/GitControlBundle/Controller/ProjectSyncController.php +++ b/src/VersionControl/GitControlBundle/Controller/ProjectSyncController.php @@ -24,6 +24,8 @@ use Symfony\Component\HttpFoundation\Request; use VersionControl\GitControlBundle\Annotation\ProjectAccess; +use Symfony\Component\Form\Extension\Core\Type\SubmitType; + /** * Project controller. * @@ -59,7 +61,7 @@ public function pushAction() $gitRemoteVersions = $this->gitSyncCommands->getRemoteVersions(); $pushForm = $this->createPushPullForm($this->project); - $pushForm->add('push', 'submit', array('label' => 'Push')); + $pushForm->add('push', SubmitType::class, array('label' => 'Push')); return array_merge($this->viewVariables, array( 'remoteVersions' => $gitRemoteVersions, @@ -82,7 +84,7 @@ public function pushToRemoteAction(Request $request,$id) $gitRemoteVersions = $this->gitSyncCommands->getRemoteVersions(); $pushForm = $this->createPushPullForm($this->project); - $pushForm->add('push', 'submit', array('label' => 'Push')); + $pushForm->add('push', SubmitType::class, array('label' => 'Push')); $pushForm->handleRequest($request); if ($pushForm->isValid()) { @@ -126,8 +128,8 @@ public function pullAction() $gitRemoteVersions = $this->gitSyncCommands->getRemoteVersions(); $pullForm = $this->createPushPullForm($this->project,"project_pulllocal"); - $pullForm->add('pull', 'submit', array('label' => 'Pull')); - $pullForm->add('viewDiff', 'submit', array('label' => 'View Diff')); + $pullForm->add('pull', SubmitType::class, array('label' => 'Pull')); + $pullForm->add('viewDiff', SubmitType::class, array('label' => 'View Diff')); return array_merge($this->viewVariables, array( 'remoteVersions' => $gitRemoteVersions, @@ -152,8 +154,8 @@ public function pullToLocalAction(Request $request,$id) $gitRemoteVersions = $this->gitSyncCommands->getRemoteVersions(); $pullForm = $this->createPushPullForm($this->project,"project_pulllocal"); - $pullForm->add('pull', 'submit', array('label' => 'Pull')); - $pullForm->add('viewDiff', 'submit', array('label' => 'View Diff')); + $pullForm->add('pull', SubmitType::class, array('label' => 'Pull')); + $pullForm->add('viewDiff', SubmitType::class, array('label' => 'View Diff')); $pullForm->handleRequest($request); if ($pullForm->isValid()) { @@ -256,7 +258,7 @@ private function createPushPullForm($project,$formAction = 'project_pushremote') ) ->getForm(); - //$form->add('submitMain', 'submit', array('label' => 'Push')); + //$form->add('submitMain', SubmitType::class, array('label' => 'Push')); return $form; } diff --git a/src/VersionControl/GitControlBundle/Controller/UserManagementController.php b/src/VersionControl/GitControlBundle/Controller/UserManagementController.php index 826496c..f00d204 100644 --- a/src/VersionControl/GitControlBundle/Controller/UserManagementController.php +++ b/src/VersionControl/GitControlBundle/Controller/UserManagementController.php @@ -24,6 +24,8 @@ use Symfony\Component\Security\Core\Exception\AccessDeniedException; +use Symfony\Component\Form\Extension\Core\Type\SubmitType; + /** * Project controller. * @Method("GET") @@ -112,7 +114,7 @@ private function createCreateForm(User $user) 'method' => 'POST', )); - $form->add('submit', 'submit', array('label' => 'Create')); + $form->add('submit', SubmitType::class, array('label' => 'Create')); return $form; } @@ -160,7 +162,7 @@ private function createEditForm(User $entity) 'method' => 'PUT', )); - $form->add('submit', 'submit', array('label' => 'Update')); + $form->add('submit', SubmitType::class, array('label' => 'Update')); return $form; } diff --git a/src/VersionControl/GitControlBundle/Controller/UserProjectsController.php b/src/VersionControl/GitControlBundle/Controller/UserProjectsController.php index 347e5bc..636121b 100644 --- a/src/VersionControl/GitControlBundle/Controller/UserProjectsController.php +++ b/src/VersionControl/GitControlBundle/Controller/UserProjectsController.php @@ -21,6 +21,8 @@ use Symfony\Component\Security\Core\Exception\AccessDeniedException; use Symfony\Component\Validator\Constraints\NotBlank; +use Symfony\Component\Form\Extension\Core\Type\SubmitType; + /** * UserProjects controller. * @@ -122,7 +124,7 @@ private function createCreateForm(UserProjects $entity,$project) 'method' => 'POST', )); - $form->add('submit', 'submit', array('label' => 'Add')); + $form->add('submit', SubmitType::class, array('label' => 'Add')); return $form; } @@ -153,7 +155,7 @@ private function createEditForm() )) ->getForm(); - $form->add('submit', 'submit', array('label' => 'Update')); + $form->add('submit', SubmitType::class, array('label' => 'Update')); return $form; } diff --git a/src/VersionControl/GitControlBundle/Form/CommitType.php b/src/VersionControl/GitControlBundle/Form/CommitType.php index 3500399..74a35a7 100644 --- a/src/VersionControl/GitControlBundle/Form/CommitType.php +++ b/src/VersionControl/GitControlBundle/Form/CommitType.php @@ -11,7 +11,7 @@ use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; -use Symfony\Component\OptionsResolver\OptionsResolverInterface; +use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\Extension\Core\Type\TextType; @@ -47,7 +47,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) // new NotBlank(array('message'=>'Please add a commit comment.')) //) )) - ->add('statushash', 'hidden', array( + ->add('statushash', HiddenType::class, array( //'data' => $this->gitCommands->getStatusHash(), //'constraints' => array( //new NotBlank() @@ -102,14 +102,14 @@ public function buildForm(FormBuilderInterface $builder, array $options) if(is_array($this->gitRemoteVersions) && count($this->gitRemoteVersions) > 0){ $remoteChoices = array(); foreach($this->gitRemoteVersions as $remoteVersion){ - $remoteChoices[$remoteVersion[0]] = $remoteVersion[0].'('.$remoteVersion[1].')'; + $remoteChoices[$remoteVersion[0].'('.$remoteVersion[1].')'] = $remoteVersion[0]; } $builder->add('pushRemote',ChoiceType::class, [ 'choices' => $remoteChoices, 'multiple' => true, 'expanded' => true, 'required' => false, - 'choices_as_values' => false, + 'choices_as_values' => true, 'label' => 'Push changes immediately to:' ]); @@ -118,9 +118,9 @@ public function buildForm(FormBuilderInterface $builder, array $options) } /** - * @param OptionsResolverInterface $resolver + * @inheritDoc */ - public function setDefaultOptions(OptionsResolverInterface $resolver) + public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults(array( 'data_class' => 'VersionControl\GitControlBundle\Entity\Commit', @@ -135,7 +135,7 @@ public function setDefaultOptions(OptionsResolverInterface $resolver) /** * @return string */ - public function getName() + public function getBlockPrefix() { return 'versioncontrol_gitcontrolbundle_commit'; } diff --git a/src/VersionControl/GitControlBundle/Form/EditUserProjectsType.php b/src/VersionControl/GitControlBundle/Form/EditUserProjectsType.php index 3f7decd..4cb4c06 100644 --- a/src/VersionControl/GitControlBundle/Form/EditUserProjectsType.php +++ b/src/VersionControl/GitControlBundle/Form/EditUserProjectsType.php @@ -43,7 +43,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) } /** - * @param OptionsResolverInterface $resolver + * @inheritDoc */ public function configureOptions(OptionsResolver $resolver) { @@ -55,7 +55,7 @@ public function configureOptions(OptionsResolver $resolver) /** * @return string */ - public function getName() + public function getBlockPrefix() { return 'versioncontrol_gitcontrolbundle_userprojects'; } diff --git a/src/VersionControl/GitControlBundle/Form/EditUserType.php b/src/VersionControl/GitControlBundle/Form/EditUserType.php index f7bc0e9..9f841ea 100644 --- a/src/VersionControl/GitControlBundle/Form/EditUserType.php +++ b/src/VersionControl/GitControlBundle/Form/EditUserType.php @@ -33,7 +33,7 @@ public function getParent() return 'fos_user_profile'; } - public function getName() + public function getBlockPrefix() { return 'version_control_user_edit'; } diff --git a/src/VersionControl/GitControlBundle/Form/Embbed/ProjectEnvironmentEmbbedType.php b/src/VersionControl/GitControlBundle/Form/Embbed/ProjectEnvironmentEmbbedType.php index cf5ada4..854ff56 100644 --- a/src/VersionControl/GitControlBundle/Form/Embbed/ProjectEnvironmentEmbbedType.php +++ b/src/VersionControl/GitControlBundle/Form/Embbed/ProjectEnvironmentEmbbedType.php @@ -20,7 +20,7 @@ class ProjectEnvironmentEmbbedType extends AbstractType{ //put your code here - public function getName(){ + public function getBlockPrefix(){ return 'projectenvironmentembbed'; } diff --git a/src/VersionControl/GitControlBundle/Form/Field/EntityHiddenType.php b/src/VersionControl/GitControlBundle/Form/Field/EntityHiddenType.php index e441417..df20cc4 100644 --- a/src/VersionControl/GitControlBundle/Form/Field/EntityHiddenType.php +++ b/src/VersionControl/GitControlBundle/Form/Field/EntityHiddenType.php @@ -12,7 +12,7 @@ use Symfony\Component\Form\AbstractType; use Dpn\ToolsBundle\Form\DataTransformer\EntityToIdTransformer; use Symfony\Component\Form\FormBuilderInterface; -use Symfony\Component\OptionsResolver\OptionsResolverInterface; +use Symfony\Component\OptionsResolver\OptionsResolver; use Doctrine\Common\Persistence\ObjectManager; class EntityHiddenType extends AbstractType @@ -33,7 +33,10 @@ public function buildForm(FormBuilderInterface $builder, array $options) $builder->addModelTransformer($transformer); } - public function setDefaultOptions(OptionsResolverInterface $resolver) + /** + * @inheritDoc + */ + public function configureOptions(OptionsResolver $resolver) { $resolver ->setRequired(array('class')) @@ -48,7 +51,7 @@ public function getParent() return 'hidden'; } - public function getName() + public function getBlockPrefix() { return 'entity_hidden'; } diff --git a/src/VersionControl/GitControlBundle/Form/IssueCommentType.php b/src/VersionControl/GitControlBundle/Form/IssueCommentType.php index 9a15832..70af4d8 100644 --- a/src/VersionControl/GitControlBundle/Form/IssueCommentType.php +++ b/src/VersionControl/GitControlBundle/Form/IssueCommentType.php @@ -11,7 +11,7 @@ use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; -use Symfony\Component\OptionsResolver\OptionsResolverInterface; +use Symfony\Component\OptionsResolver\OptionsResolver; class IssueCommentType extends AbstractType { @@ -31,9 +31,9 @@ public function buildForm(FormBuilderInterface $builder, array $options) } /** - * @param OptionsResolverInterface $resolver + * @inheritDoc */ - public function setDefaultOptions(OptionsResolverInterface $resolver) + public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults(array( 'data_class' => 'VersionControl\GitControlBundle\Entity\IssueComment' @@ -43,7 +43,7 @@ public function setDefaultOptions(OptionsResolverInterface $resolver) /** * @return string */ - public function getName() + public function getBlockPrefix() { return 'versioncontrol_gitcontrolbundle_issuecomment'; } diff --git a/src/VersionControl/GitControlBundle/Form/IssueEditType.php b/src/VersionControl/GitControlBundle/Form/IssueEditType.php index 63af9c9..1182688 100644 --- a/src/VersionControl/GitControlBundle/Form/IssueEditType.php +++ b/src/VersionControl/GitControlBundle/Form/IssueEditType.php @@ -11,7 +11,7 @@ use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; -use Symfony\Component\OptionsResolver\OptionsResolverInterface; +use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\Extension\Core\Type\EntityType; @@ -52,9 +52,9 @@ public function buildForm(FormBuilderInterface $builder, array $options) } /** - * @param OptionsResolverInterface $resolver + * @inheritDoc */ - public function setDefaultOptions(OptionsResolverInterface $resolver) + public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults(array( 'data_class' => 'VersionControl\GitControlBundle\Entity\Issue' @@ -64,7 +64,7 @@ public function setDefaultOptions(OptionsResolverInterface $resolver) /** * @return string */ - public function getName() + public function getBlockPrefix() { return 'versioncontrol_gitcontrolbundle_issue'; } diff --git a/src/VersionControl/GitControlBundle/Form/IssueLabelType.php b/src/VersionControl/GitControlBundle/Form/IssueLabelType.php index 4b23ae9..b87dc6f 100644 --- a/src/VersionControl/GitControlBundle/Form/IssueLabelType.php +++ b/src/VersionControl/GitControlBundle/Form/IssueLabelType.php @@ -11,7 +11,7 @@ use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; -use Symfony\Component\OptionsResolver\OptionsResolverInterface; +use Symfony\Component\OptionsResolver\OptionsResolver; class IssueLabelType extends AbstractType { @@ -31,9 +31,9 @@ public function buildForm(FormBuilderInterface $builder, array $options) } /** - * @param OptionsResolverInterface $resolver + * @inheritDoc */ - public function setDefaultOptions(OptionsResolverInterface $resolver) + public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults(array( 'data_class' => 'VersionControl\GitControlBundle\Entity\IssueLabel' @@ -43,7 +43,7 @@ public function setDefaultOptions(OptionsResolverInterface $resolver) /** * @return string */ - public function getName() + public function getBlockPrefix() { return 'versioncontrol_gitcontrolbundle_issuelabel'; } diff --git a/src/VersionControl/GitControlBundle/Form/IssueMilestoneType.php b/src/VersionControl/GitControlBundle/Form/IssueMilestoneType.php index 3c7209a..99bc5af 100644 --- a/src/VersionControl/GitControlBundle/Form/IssueMilestoneType.php +++ b/src/VersionControl/GitControlBundle/Form/IssueMilestoneType.php @@ -50,7 +50,7 @@ public function configureOptions(OptionsResolver $resolver) /** * @return string */ - public function getName() + public function getBlockPrefix() { return 'versioncontrol_gitcontrolbundle_issuemilestone'; } diff --git a/src/VersionControl/GitControlBundle/Form/IssueType.php b/src/VersionControl/GitControlBundle/Form/IssueType.php index 2cd7438..3aa7ab0 100644 --- a/src/VersionControl/GitControlBundle/Form/IssueType.php +++ b/src/VersionControl/GitControlBundle/Form/IssueType.php @@ -11,7 +11,7 @@ use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; -use Symfony\Component\OptionsResolver\OptionsResolverInterface; +use Symfony\Component\OptionsResolver\OptionsResolver; use VersionControl\GitControlBundle\Repository\IssueMilestoneRepository; //use VersionControl\GitControlBundle\Repository\IssueLabelRepository; use Doctrine\ORM\EntityRepository; @@ -75,9 +75,9 @@ public function buildForm(FormBuilderInterface $builder, array $options) } /** - * @param OptionsResolverInterface $resolver + * @inheritDoc */ - public function setDefaultOptions(OptionsResolverInterface $resolver) + public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults(array( 'data_class' => 'VersionControl\GitControlBundle\Entity\Issue' @@ -87,7 +87,7 @@ public function setDefaultOptions(OptionsResolverInterface $resolver) /** * @return string */ - public function getName() + public function getBlockPrefix() { return 'versioncontrol_gitcontrolbundle_issue'; } diff --git a/src/VersionControl/GitControlBundle/Form/ProjectEnvironmentFilePermType.php b/src/VersionControl/GitControlBundle/Form/ProjectEnvironmentFilePermType.php index 926cfdf..73caed2 100644 --- a/src/VersionControl/GitControlBundle/Form/ProjectEnvironmentFilePermType.php +++ b/src/VersionControl/GitControlBundle/Form/ProjectEnvironmentFilePermType.php @@ -100,7 +100,7 @@ public function configureOptions(OptionsResolver $resolver) /** * @return string */ - public function getName() + public function getBlockPrefix() { return 'versioncontrol_gitcontrolbundle_projectenvironmentfileperm'; } diff --git a/src/VersionControl/GitControlBundle/Form/ProjectEnvironmentType.php b/src/VersionControl/GitControlBundle/Form/ProjectEnvironmentType.php index acc707c..a586de7 100644 --- a/src/VersionControl/GitControlBundle/Form/ProjectEnvironmentType.php +++ b/src/VersionControl/GitControlBundle/Form/ProjectEnvironmentType.php @@ -83,7 +83,7 @@ public function configureOptions(OptionsResolver $resolver) /** * @return string */ - public function getName() + public function getBlockPrefix() { return 'versioncontrol_gitcontrolbundle_projectenvironment'; } diff --git a/src/VersionControl/GitControlBundle/Form/ProjectIssueIntegratorType.php b/src/VersionControl/GitControlBundle/Form/ProjectIssueIntegratorType.php index 9a8e1e5..900d753 100644 --- a/src/VersionControl/GitControlBundle/Form/ProjectIssueIntegratorType.php +++ b/src/VersionControl/GitControlBundle/Form/ProjectIssueIntegratorType.php @@ -11,7 +11,7 @@ use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; -use Symfony\Component\OptionsResolver\OptionsResolverInterface; +use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\Extension\Core\Type\EntityType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; @@ -45,9 +45,9 @@ public function buildForm(FormBuilderInterface $builder, array $options) } /** - * @param OptionsResolverInterface $resolver + * @inheritDoc */ - public function setDefaultOptions(OptionsResolverInterface $resolver) + public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults(array( 'data_class' => 'VersionControl\GitControlBundle\Entity\ProjectIssueIntegrator' @@ -57,7 +57,7 @@ public function setDefaultOptions(OptionsResolverInterface $resolver) /** * @return string */ - public function getName() + public function getBlockPrefix() { return 'versioncontrol_gitcontrolbundle_projectissueintegrator'; } diff --git a/src/VersionControl/GitControlBundle/Form/ProjectType.php b/src/VersionControl/GitControlBundle/Form/ProjectType.php index a48ee34..9d97c47 100644 --- a/src/VersionControl/GitControlBundle/Form/ProjectType.php +++ b/src/VersionControl/GitControlBundle/Form/ProjectType.php @@ -50,7 +50,7 @@ public function configureOptions(OptionsResolver $resolver) /** * @return string */ - public function getName() + public function getBlockPrefix() { return 'versioncontrol_gitcontrolbundle_project'; } diff --git a/src/VersionControl/GitControlBundle/Form/RegistrationType.php b/src/VersionControl/GitControlBundle/Form/RegistrationType.php index d2724a0..6213e3f 100644 --- a/src/VersionControl/GitControlBundle/Form/RegistrationType.php +++ b/src/VersionControl/GitControlBundle/Form/RegistrationType.php @@ -30,7 +30,7 @@ public function getParent() return 'fos_user_registration'; } - public function getName() + public function getBlockPrefix() { return 'version_control_user_registration'; } diff --git a/src/VersionControl/GitControlBundle/Form/UserProjectsType.php b/src/VersionControl/GitControlBundle/Form/UserProjectsType.php index 468cf52..efe2c65 100644 --- a/src/VersionControl/GitControlBundle/Form/UserProjectsType.php +++ b/src/VersionControl/GitControlBundle/Form/UserProjectsType.php @@ -79,7 +79,7 @@ public function configureOptions(OptionsResolver $resolver) /** * @return string */ - public function getName() + public function getBlockPrefix() { return 'versioncontrol_gitcontrolbundle_userprojects'; } From d44b1f79187b52a1b28437f44620eada8243a9a1 Mon Sep 17 00:00:00 2001 From: Paul Schweppe Date: Thu, 6 Oct 2016 16:45:54 +0100 Subject: [PATCH 02/60] Fixed up deprecations errors for symfony 3.0 --- .../Controller/ProjectBranchController.php | 16 +++++++----- .../Controller/ProjectController.php | 8 +++--- .../Controller/ProjectHistoryController.php | 13 +++++++--- .../Controller/ProjectRemoteController.php | 10 ++++--- .../Controller/ProjectSyncController.php | 16 +++++++----- .../Controller/UserProjectsController.php | 3 ++- .../GitControlBundle/Entity/Project.php | 2 +- .../Entity/ProjectEnvironment.php | 2 +- .../Embbed/ProjectEnvironmentEmbbedType.php | 2 +- .../Form/ProjectEnvironmentFilePermType.php | 2 +- .../Form/ProjectEnvironmentType.php | 2 +- .../GitControlBundle/Form/ProjectType.php | 1 - .../Issues/IssueRepositoryManager.php | 26 ++++++++++++------- .../Resources/translations/messages.en.xlf | 2 +- .../Validator/Constraints/SshDetails.php | 2 +- .../Constraints/SshDetailsValidator.php | 6 ++++- ...ProjectIssueIntegratorGithubController.php | 8 +++--- .../Form/IssueCommentType.php | 10 ++++--- .../GithubIssueBundle/Form/IssueEditType.php | 17 +++++++----- .../GithubIssueBundle/Form/IssueLabelType.php | 6 ++--- .../Form/IssueMilestoneType.php | 8 +++--- .../GithubIssueBundle/Form/IssueType.php | 13 ++++++---- .../Form/ProjectIssueIntegratorGithubType.php | 6 ++--- .../Resources/config/services.yml | 10 +++++++ ...ProjectIssueIntegratorGitlabController.php | 8 +++--- .../Form/Field/GitlabProjectType.php | 6 ++--- .../Form/IssueCommentType.php | 11 ++++---- .../GitlabIssueBundle/Form/IssueEditType.php | 17 +++++++----- .../GitlabIssueBundle/Form/IssueLabelType.php | 6 ++--- .../Form/IssueMilestoneType.php | 10 ++++--- .../GitlabIssueBundle/Form/IssueType.php | 15 ++++++----- .../ProjectIssueIntegratorGitlabNewType.php | 6 ++--- .../Form/ProjectIssueIntegratorGitlabType.php | 6 ++--- .../Resources/config/services.yml | 10 +++++++ 34 files changed, 178 insertions(+), 108 deletions(-) diff --git a/src/VersionControl/GitControlBundle/Controller/ProjectBranchController.php b/src/VersionControl/GitControlBundle/Controller/ProjectBranchController.php index b7a7b0a..adbd765 100644 --- a/src/VersionControl/GitControlBundle/Controller/ProjectBranchController.php +++ b/src/VersionControl/GitControlBundle/Controller/ProjectBranchController.php @@ -21,8 +21,12 @@ use Symfony\Component\Security\Core\Exception\AccessDeniedException; use Symfony\Component\HttpFoundation\Request; use VersionControl\GitControlBundle\Annotation\ProjectAccess; -use Symfony\Component\Form\Extension\Core\Type\SubmitType; +use Symfony\Component\Form\Extension\Core\Type\SubmitType; +use Symfony\Component\Form\Extension\Core\Type\ChoiceType; +use Symfony\Component\Form\Extension\Core\Type\TextType; +use Symfony\Component\Form\Extension\Core\Type\CheckboxType; +use Symfony\Component\Form\Extension\Core\Type\HiddenType; /** * Project controller. * @@ -128,7 +132,7 @@ public function remoteBranchesAction($id) { $gitRemoteBranches = $this->gitCommands->command('branch')->getBranchRemoteListing(); $form = $this->createNewBranchForm($this->project, array(), 'project_branch_remote_checkout'); - $form->add('remotename', 'hidden', array( + $form->add('remotename', HiddenType::class, array( 'label' => 'Remote Branch Name' , 'required' => true , 'constraints' => array( @@ -157,7 +161,7 @@ public function checkoutRemoteBranchAction(Request $request, $id) { $gitRemoteBranches = $this->gitCommands->command('branch')->getBranchRemoteListing(); $form = $this->createNewBranchForm($this->project, array(), 'project_branch_remote_checkout'); - $form->add('remotename', 'hidden', array( + $form->add('remotename', HiddenType::class, array( 'label' => 'Remote Branch Name' , 'required' => true , 'constraints' => array( @@ -243,14 +247,14 @@ private function createNewBranchForm($project, $defaultData = array(), $formActi 'action' => $this->generateUrl($formAction, array('id' => $project->getId())), 'method' => 'POST', )) - ->add('name', 'text', array( + ->add('name', TextType::class, array( 'label' => 'Branch Name' , 'required' => true , 'constraints' => array( new NotBlank() )) ) - ->add('switch', 'checkbox', array( + ->add('switch', CheckboxType::class, array( 'label' => 'Switch to branch on creation' , 'required' => false ) @@ -308,7 +312,7 @@ private function createMergeBranchForm($project, $branches, $formAction = 'proje 'action' => $this->generateUrl($formAction, array('id' => $project->getId())), 'method' => 'POST', )) - ->add('branch', 'choice', array( + ->add('branch', ChoiceType::class, array( 'choices' => $branches , 'label' => 'Branch Name' , 'required' => true diff --git a/src/VersionControl/GitControlBundle/Controller/ProjectController.php b/src/VersionControl/GitControlBundle/Controller/ProjectController.php index 9104ae2..a1f8e2e 100644 --- a/src/VersionControl/GitControlBundle/Controller/ProjectController.php +++ b/src/VersionControl/GitControlBundle/Controller/ProjectController.php @@ -81,12 +81,12 @@ public function createAction(Request $request) */ private function createCreateForm(Project $entity) { - $form = $this->createForm(new ProjectType(), $entity, array( + $form = $this->createForm(ProjectType::class, $entity, array( 'action' => $this->generateUrl('project_create'), 'method' => 'POST', )); - $form->add('submit', SubmitType::class, array('label' => 'Create')); + $form->add('submit', SubmitType::class, array('label' => 'Create','validation_groups' => 'New')); return $form; } @@ -149,12 +149,12 @@ public function editAction($id) */ private function createEditForm(Project $entity) { - $form = $this->createForm(new ProjectType(), $entity, array( + $form = $this->createForm(ProjectType::class, $entity, array( 'action' => $this->generateUrl('project_update', array('id' => $entity->getId())), 'method' => 'PUT', )); - $form->add('submit', SubmitType::class, array('label' => 'Update')); + $form->add('submit', SubmitType::class, array('label' => 'Update','validation_groups' => 'Edit')); return $form; } diff --git a/src/VersionControl/GitControlBundle/Controller/ProjectHistoryController.php b/src/VersionControl/GitControlBundle/Controller/ProjectHistoryController.php index 2225e89..7ea9506 100644 --- a/src/VersionControl/GitControlBundle/Controller/ProjectHistoryController.php +++ b/src/VersionControl/GitControlBundle/Controller/ProjectHistoryController.php @@ -23,6 +23,12 @@ use Symfony\Component\HttpFoundation\Request; use VersionControl\GitControlBundle\Annotation\ProjectAccess; +use Symfony\Component\Form\Extension\Core\Type\ChoiceType; +use Symfony\Component\Form\Extension\Core\Type\HiddenType; +use Symfony\Component\Form\Extension\Core\Type\TextType; + + + /** * Project controller. * @@ -238,18 +244,19 @@ private function createSearchForm() 'action' => $this->generateUrl('project_log', array('id' => $this->project->getId())), 'method' => 'GET', )) - ->add('branch', 'choice', array( + ->add('branch', ChoiceType::class, array( 'label' => 'Branch' ,'choices' => $branchChoices ,'preferred_choices' => array($currentBranch) ,'data' => trim($currentBranch) ,'required' => false + ,'choices_as_values' => true ,'constraints' => array( //new NotBlank() )) ) - ->add('filter','hidden') - ->add('keyword','text',array('required' => false)) + ->add('filter',HiddenType::class) + ->add('keyword',TextType::class,array('required' => false)) ->getForm(); //$form->add('submitMain', 'submit', array('label' => 'Push')); diff --git a/src/VersionControl/GitControlBundle/Controller/ProjectRemoteController.php b/src/VersionControl/GitControlBundle/Controller/ProjectRemoteController.php index 438454d..48e0593 100644 --- a/src/VersionControl/GitControlBundle/Controller/ProjectRemoteController.php +++ b/src/VersionControl/GitControlBundle/Controller/ProjectRemoteController.php @@ -26,6 +26,8 @@ use VersionControl\GitControlBundle\Annotation\ProjectAccess; use Symfony\Component\Form\Extension\Core\Type\SubmitType; +use Symfony\Component\Form\Extension\Core\Type\TextType; +use Symfony\Component\Form\Extension\Core\Type\HiddenType; /** * Project controller. * @@ -232,14 +234,14 @@ private function createRemoteForm(){ 'action' => $this->generateUrl('project_createremote', array('id' => $this->project->getId())), 'method' => 'POST', )) - ->add('remoteName', 'text', array( + ->add('remoteName', TextType::class, array( 'label' => 'Remote Name' ,'required' => false ,'constraints' => array( new NotBlank() )) ) - ->add('remoteUrl', 'text', array( + ->add('remoteUrl', TextType::class, array( 'label' => 'Remote Url' ,'required' => false ,'constraints' => array( @@ -259,12 +261,12 @@ private function createRenameRemoteForm($defaultData = array()){ 'action' => $this->generateUrl('project_createremote', array('id' => $this->project->getId())), 'method' => 'POST', )) - ->add('remoteName', 'hidden', array( + ->add('remoteName', HiddenType::class, array( 'constraints' => array( new NotBlank() )) ) - ->add('newRemoteName', 'text', array( + ->add('newRemoteName', TextType::class, array( 'label' => 'New Remote Name' ,'required' => false ,'constraints' => array( diff --git a/src/VersionControl/GitControlBundle/Controller/ProjectSyncController.php b/src/VersionControl/GitControlBundle/Controller/ProjectSyncController.php index 5eb4870..a07bebf 100644 --- a/src/VersionControl/GitControlBundle/Controller/ProjectSyncController.php +++ b/src/VersionControl/GitControlBundle/Controller/ProjectSyncController.php @@ -25,6 +25,7 @@ use VersionControl\GitControlBundle\Annotation\ProjectAccess; use Symfony\Component\Form\Extension\Core\Type\SubmitType; +use Symfony\Component\Form\Extension\Core\Type\ChoiceType; /** * Project controller. @@ -215,8 +216,8 @@ private function createPushPullForm($project,$formAction = 'project_pushremote') //Remote Server choice $gitRemoteVersions = $this->gitSyncCommands->getRemoteVersions(); $remoteChoices = array(); - foreach($gitRemoteVersions as $remoteVersion){ - $remoteChoices[$remoteVersion[0]] = $remoteVersion[0].'('.$remoteVersion[1].')'; + foreach($gitRemoteVersions as $remoteVersion){ + $remoteChoices[$remoteVersion[0].'('.$remoteVersion[1].')'] = $remoteVersion[0]; } //Local Branch choice @@ -229,29 +230,30 @@ private function createPushPullForm($project,$formAction = 'project_pushremote') //Current branch $currentBranch = $this->gitCommands->command('branch')->getCurrentBranch(); - reset($remoteChoices); - $firstOrigin = key($remoteChoices); - + $firstOrigin = reset($remoteChoices); + $defaultData = array('branch' => $currentBranch); $form = $this->createFormBuilder($defaultData, array( 'action' => $this->generateUrl($formAction, array('id' => $project->getId())), 'method' => 'POST', )) - ->add('remote', 'choice', array( + ->add('remote', ChoiceType::class, array( 'label' => 'Remote Server' ,'choices' => $remoteChoices ,'data' => $firstOrigin ,'required' => false + ,'choices_as_values' => true ,'constraints' => array( new NotBlank() )) ) - ->add('branch', 'choice', array( + ->add('branch', ChoiceType::class, array( 'label' => 'Branch' ,'choices' => $branchChoices ,'preferred_choices' => array($currentBranch) ,'data' => trim($currentBranch) ,'required' => false + ,'choices_as_values' => true ,'constraints' => array( new NotBlank() )) diff --git a/src/VersionControl/GitControlBundle/Controller/UserProjectsController.php b/src/VersionControl/GitControlBundle/Controller/UserProjectsController.php index 636121b..cb2d452 100644 --- a/src/VersionControl/GitControlBundle/Controller/UserProjectsController.php +++ b/src/VersionControl/GitControlBundle/Controller/UserProjectsController.php @@ -22,6 +22,7 @@ use Symfony\Component\Validator\Constraints\NotBlank; use Symfony\Component\Form\Extension\Core\Type\SubmitType; +use Symfony\Component\Form\Extension\Core\Type\ChoiceType; /** * UserProjects controller. @@ -144,7 +145,7 @@ private function createEditForm() $form = $this->createFormBuilder(array(), array( 'method' => 'POST', )) - ->add('roles','choice', array( + ->add('roles',ChoiceType::class, array( 'label' => 'User Role' ,'choices' => array('Reporter' => 'Reporter', 'Developer' => 'Developer', 'Master' => 'Master') ,'required' => false diff --git a/src/VersionControl/GitControlBundle/Entity/Project.php b/src/VersionControl/GitControlBundle/Entity/Project.php index dff9f81..9f1e6a3 100644 --- a/src/VersionControl/GitControlBundle/Entity/Project.php +++ b/src/VersionControl/GitControlBundle/Entity/Project.php @@ -30,7 +30,7 @@ class Project /** * @var string * @ORM\Column(name="title", type="string", length=80, nullable=true) - * @Assert\NotBlank() + * @Assert\NotBlank(groups={"New,Edit"}) */ private $title; diff --git a/src/VersionControl/GitControlBundle/Entity/ProjectEnvironment.php b/src/VersionControl/GitControlBundle/Entity/ProjectEnvironment.php index 81f84a5..66ecba6 100644 --- a/src/VersionControl/GitControlBundle/Entity/ProjectEnvironment.php +++ b/src/VersionControl/GitControlBundle/Entity/ProjectEnvironment.php @@ -19,7 +19,7 @@ * @ORM\Entity * @ORM\Entity(repositoryClass="VersionControl\GitControlBundle\Repository\ProjectEnvironmentRepository") * @ORM\Table(name="project_environment") - * @VersionControlAssert\SshDetails + * @VersionControlAssert\SshDetails() * @VersionControlAssert\GitFolderExists(groups={"ExistingGit"}) * @VersionControlAssert\GitFolderNotExists(groups={"CloneGit","NewGit"}) */ diff --git a/src/VersionControl/GitControlBundle/Form/Embbed/ProjectEnvironmentEmbbedType.php b/src/VersionControl/GitControlBundle/Form/Embbed/ProjectEnvironmentEmbbedType.php index 854ff56..7e5a4d5 100644 --- a/src/VersionControl/GitControlBundle/Form/Embbed/ProjectEnvironmentEmbbedType.php +++ b/src/VersionControl/GitControlBundle/Form/Embbed/ProjectEnvironmentEmbbedType.php @@ -36,7 +36,7 @@ public function configureOptions(OptionsResolver $resolver) $resolver->setDefaults(array( //'data_class' => 'Lre\MetadataBundle\Entity\Curriculum\ResourceCurriculum', //'data_class' => NULL, - 'cascade_validation' => true, + //'cascade_validation' => true, )); } diff --git a/src/VersionControl/GitControlBundle/Form/ProjectEnvironmentFilePermType.php b/src/VersionControl/GitControlBundle/Form/ProjectEnvironmentFilePermType.php index 73caed2..04ed239 100644 --- a/src/VersionControl/GitControlBundle/Form/ProjectEnvironmentFilePermType.php +++ b/src/VersionControl/GitControlBundle/Form/ProjectEnvironmentFilePermType.php @@ -93,7 +93,7 @@ public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults(array( 'data_class' => 'VersionControl\GitControlBundle\Entity\ProjectEnvironmentFilePerm' - ,'cascade_validation' => true + //,'cascade_validation' => true )); } diff --git a/src/VersionControl/GitControlBundle/Form/ProjectEnvironmentType.php b/src/VersionControl/GitControlBundle/Form/ProjectEnvironmentType.php index a586de7..8c9551f 100644 --- a/src/VersionControl/GitControlBundle/Form/ProjectEnvironmentType.php +++ b/src/VersionControl/GitControlBundle/Form/ProjectEnvironmentType.php @@ -60,7 +60,7 @@ public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults(array( 'data_class' => 'VersionControl\GitControlBundle\Entity\ProjectEnvironment' - ,'cascade_validation' => true + //,'cascade_validation' => true ,'validation_groups' => function (FormInterface $form) { if($form->has('gitaction')){ diff --git a/src/VersionControl/GitControlBundle/Form/ProjectType.php b/src/VersionControl/GitControlBundle/Form/ProjectType.php index 9d97c47..3d32507 100644 --- a/src/VersionControl/GitControlBundle/Form/ProjectType.php +++ b/src/VersionControl/GitControlBundle/Form/ProjectType.php @@ -43,7 +43,6 @@ public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults(array( 'data_class' => 'VersionControl\GitControlBundle\Entity\Project' - ,'cascade_validation' => true )); } diff --git a/src/VersionControl/GitControlBundle/Repository/Issues/IssueRepositoryManager.php b/src/VersionControl/GitControlBundle/Repository/Issues/IssueRepositoryManager.php index a41b670..aa25416 100644 --- a/src/VersionControl/GitControlBundle/Repository/Issues/IssueRepositoryManager.php +++ b/src/VersionControl/GitControlBundle/Repository/Issues/IssueRepositoryManager.php @@ -122,10 +122,13 @@ public function setProject($project) { public function getIssueFormType(){ if($this->issueIntegrator){ + $repoType = $this->issueIntegrator->getRepoType(); - $issueFormType = $this->serviceContainer->get('version_control.issue_form_type.'.strtolower($repoType)); + $issueFormType = 'VersionControl\\'.$repoType.'IssueBundle\Form\IssueType'; + }else{ - $issueFormType = new IssueType($this); + $issueFormType = IssueType::class; + } return $issueFormType; } @@ -134,9 +137,9 @@ public function getIssueEditFormType(){ if($this->issueIntegrator){ $repoType = $this->issueIntegrator->getRepoType(); - $issueEditFormType = $this->serviceContainer->get('version_control.issue_form_edit_type.'.strtolower($repoType)); + $issueEditFormType = "VersionControl\\".$repoType."IssueBundle\Form\IssueEditType"; }else{ - $issueEditFormType = new IssueEditType($this); + $issueEditFormType = IssueEditType::class; } return $issueEditFormType; @@ -145,9 +148,10 @@ public function getIssueEditFormType(){ public function getIssueCommentFormType(){ if($this->issueIntegrator){ $repoType = $this->issueIntegrator->getRepoType(); - $issueFormType = $this->serviceContainer->get('version_control.issue_comment_form_type.'.strtolower($repoType)); + //$issueFormType = $this->serviceContainer->get("version_control.issue_comment_form_type.'.strtolower($repoType)); + $issueFormType = 'VersionControl\\'.$repoType.'IssueBundle\Form\IssueCommentType'; }else{ - $issueFormType = new IssueCommentType($this); + $issueFormType = IssueCommentType::class; } return $issueFormType; } @@ -155,9 +159,10 @@ public function getIssueCommentFormType(){ public function getIssueLabelFormType(){ if($this->issueIntegrator){ $repoType = $this->issueIntegrator->getRepoType(); - $issueFormType = $this->serviceContainer->get('version_control.issue_label_form_type.'.strtolower($repoType)); + //$issueFormType = $this->serviceContainer->get('version_control.issue_label_form_type.'.strtolower($repoType)); + $issueFormType = 'VersionControl\\'.$repoType.'IssueBundle\Form\IssueLabelType'; }else{ - $issueFormType = new IssueLabelType($this); + $issueFormType = IssueLabelType::class; } return $issueFormType; } @@ -165,9 +170,10 @@ public function getIssueLabelFormType(){ public function getIssueMilestoneFormType(){ if($this->issueIntegrator){ $repoType = $this->issueIntegrator->getRepoType(); - $issueFormType = $this->serviceContainer->get('version_control.issue_milestone_form_type.'.strtolower($repoType)); + //$issueFormType = $this->serviceContainer->get('version_control.issue_milestone_form_type.'.strtolower($repoType)); + $issueFormType = 'VersionControl\\'.$repoType.'IssueBundle\Form\IssueMilestoneType'; }else{ - $issueFormType = new IssueMilestoneType($this); + $issueFormType = IssueMilestoneType::class; } return $issueFormType; } diff --git a/src/VersionControl/GitControlBundle/Resources/translations/messages.en.xlf b/src/VersionControl/GitControlBundle/Resources/translations/messages.en.xlf index e1e6105..e6ca283 100644 --- a/src/VersionControl/GitControlBundle/Resources/translations/messages.en.xlf +++ b/src/VersionControl/GitControlBundle/Resources/translations/messages.en.xlf @@ -8,7 +8,7 @@ validate.constraint.SshDetails.FileDoesNotExist - This directory does not exist. Please check that you have entered the correct path + This directory (%gitPath%) does not exist. Please check that you have entered the correct path in %projectEnviromentTitle% diff --git a/src/VersionControl/GitControlBundle/Validator/Constraints/SshDetails.php b/src/VersionControl/GitControlBundle/Validator/Constraints/SshDetails.php index d18ea1a..a3cfecf 100644 --- a/src/VersionControl/GitControlBundle/Validator/Constraints/SshDetails.php +++ b/src/VersionControl/GitControlBundle/Validator/Constraints/SshDetails.php @@ -20,7 +20,7 @@ class SshDetails extends Constraint { public $message = 'validate.constraint.SshDetails'; - public $messageFileDoesNotExist = 'validate.constraint.SshDetails.FileDoesNotExist'; + public $messageFileDoesNotExist = 'This directory (%gitPath%) does not exist. Please check that you have entered the correct path in %projectEnviromentTitle%'; public function validatedBy() { diff --git a/src/VersionControl/GitControlBundle/Validator/Constraints/SshDetailsValidator.php b/src/VersionControl/GitControlBundle/Validator/Constraints/SshDetailsValidator.php index 914e4bf..41a491e 100644 --- a/src/VersionControl/GitControlBundle/Validator/Constraints/SshDetailsValidator.php +++ b/src/VersionControl/GitControlBundle/Validator/Constraints/SshDetailsValidator.php @@ -43,8 +43,11 @@ public function validate($projectEnvironment, Constraint $constraint) $this->sftpProcess->setGitEnviroment($projectEnvironment); try{ + if ($this->sftpProcess->isDir($gitPath) === false){ - $this->context->buildViolation($constraint->messageFileDoesNotExist) + $this->context->buildViolation('This directory (%gitPath%) does not exist. Please check that you have entered the correct path in %projectEnviromentTitle%') + ->setParameter('%gitPath%', $gitPath) + ->setParameter('%projectEnviromentTitle%', $projectEnvironment->getTitle()) ->atPath('path') ->addViolation(); } @@ -54,6 +57,7 @@ public function validate($projectEnvironment, Constraint $constraint) ->addViolation(); } catch (\Exception $ex) { $this->context->buildViolation($constraint->message) + ->atPath('title') ->addViolation(); } diff --git a/src/VersionControl/GithubIssueBundle/Controller/ProjectIssueIntegratorGithubController.php b/src/VersionControl/GithubIssueBundle/Controller/ProjectIssueIntegratorGithubController.php index 94dc9b3..22e0a9b 100755 --- a/src/VersionControl/GithubIssueBundle/Controller/ProjectIssueIntegratorGithubController.php +++ b/src/VersionControl/GithubIssueBundle/Controller/ProjectIssueIntegratorGithubController.php @@ -23,6 +23,8 @@ use Symfony\Component\Security\Core\Exception\AccessDeniedException; use VersionControl\GitControlBundle\Annotation\ProjectAccess; + +use Symfony\Component\Form\Extension\Core\Type\SubmitType; /** * Project controller. * @@ -85,7 +87,7 @@ private function createCreateForm(ProjectIssueIntegrator $issueIntegrator) 'method' => 'POST', )); - $form->add('submit', 'submit', array('label' => 'Create')); + $form->add('submit', SubmitType::class, array('label' => 'Create')); return $form; } @@ -159,7 +161,7 @@ private function createEditForm(ProjectIssueIntegrator $issueIntegrator) 'method' => 'PUT', )); - $form->add('submit', 'submit', array('label' => 'Update')); + $form->add('submit', SubmitType::class, array('label' => 'Update')); return $form; } @@ -217,7 +219,7 @@ private function createDeleteForm($integratorId) return $this->createFormBuilder() ->setAction($this->generateUrl('project_issue_integrator_delete', array('id' => $this->project->getId(), 'integratorId' => $integratorId))) ->setMethod('DELETE') - ->add('submit', 'submit', array('label' => 'Delete')) + ->add('submit', SubmitType::class, array('label' => 'Delete')) ->getForm() ; } diff --git a/src/VersionControl/GithubIssueBundle/Form/IssueCommentType.php b/src/VersionControl/GithubIssueBundle/Form/IssueCommentType.php index 95fe9ee..27d22bc 100755 --- a/src/VersionControl/GithubIssueBundle/Form/IssueCommentType.php +++ b/src/VersionControl/GithubIssueBundle/Form/IssueCommentType.php @@ -11,7 +11,9 @@ use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; -use Symfony\Component\OptionsResolver\OptionsResolverInterface; +use Symfony\Component\OptionsResolver\OptionsResolver; + +use Symfony\Component\Form\Extension\Core\Type\TextareaType; class IssueCommentType extends AbstractType { @@ -22,7 +24,7 @@ class IssueCommentType extends AbstractType public function buildForm(FormBuilderInterface $builder, array $options) { $builder - ->add('comment','textarea') + ->add('comment',TextareaType::class) //->add('issue', 'hidden_entity',array( // 'class' => 'VersionControl\GithubIssueBundle\Entity\Issues\Issue' // )) @@ -33,7 +35,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) /** * @param OptionsResolverInterface $resolver */ - public function setDefaultOptions(OptionsResolverInterface $resolver) + public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults(array( 'data_class' => 'VersionControl\GithubIssueBundle\Entity\Issues\IssueComment' @@ -43,7 +45,7 @@ public function setDefaultOptions(OptionsResolverInterface $resolver) /** * @return string */ - public function getName() + public function getBlockPrefix() { return 'versioncontrol_gitcontrolbundle_issuecomment'; } diff --git a/src/VersionControl/GithubIssueBundle/Form/IssueEditType.php b/src/VersionControl/GithubIssueBundle/Form/IssueEditType.php index 8856850..cae9cfd 100755 --- a/src/VersionControl/GithubIssueBundle/Form/IssueEditType.php +++ b/src/VersionControl/GithubIssueBundle/Form/IssueEditType.php @@ -11,7 +11,10 @@ use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; -use Symfony\Component\OptionsResolver\OptionsResolverInterface; +use Symfony\Component\OptionsResolver\OptionsResolver; + +use Symfony\Component\Form\Extension\Core\Type\TextareaType; +use Symfony\Component\Form\Extension\Core\Type\ChoiceType; class IssueEditType extends AbstractType { @@ -30,13 +33,13 @@ public function buildForm(FormBuilderInterface $builder, array $options) { $builder ->add('title') - ->add('description') - ->add('status','choice',array('label' => 'State' + ->add('description',TextareaType::class) + ->add('status',ChoiceType::class,array('label' => 'State' ,'choices' => array('open' => 'Open', 'closed' => 'Close') ,'required' => false ,'empty_value' => 'Please select a State') ) - ->add('issueMilestone','choice',array( + ->add('issueMilestone',ChoiceType::class,array( 'choices' => $this->getIssueMilestoneChoices(), 'multiple' => false, // Multiple selection allowed //'expanded' => true, // Render as checkboxes @@ -62,7 +65,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) ->orderBy('a.id', 'ASC'); },*/ )) - ->add('issueLabel','choice',array( + ->add('issueLabel',ChoiceType::class,array( 'choices' => $this->getIssueLabelChoices(), 'multiple' => true, // Multiple selection allowed 'expanded' => true, // Render as checkboxes @@ -105,7 +108,7 @@ protected function getIssueLabelChoices(){ /** * @param OptionsResolverInterface $resolver */ - public function setDefaultOptions(OptionsResolverInterface $resolver) + public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults(array( 'data_class' => 'VersionControl\GitControlBundle\Entity\Issue' @@ -115,7 +118,7 @@ public function setDefaultOptions(OptionsResolverInterface $resolver) /** * @return string */ - public function getName() + public function getBlockPrefix() { return 'versioncontrol_gitcontrolbundle_issue'; } diff --git a/src/VersionControl/GithubIssueBundle/Form/IssueLabelType.php b/src/VersionControl/GithubIssueBundle/Form/IssueLabelType.php index 69c88d3..2566b47 100755 --- a/src/VersionControl/GithubIssueBundle/Form/IssueLabelType.php +++ b/src/VersionControl/GithubIssueBundle/Form/IssueLabelType.php @@ -11,7 +11,7 @@ use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; -use Symfony\Component\OptionsResolver\OptionsResolverInterface; +use Symfony\Component\OptionsResolver\OptionsResolver; class IssueLabelType extends AbstractType { @@ -33,7 +33,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) /** * @param OptionsResolverInterface $resolver */ - public function setDefaultOptions(OptionsResolverInterface $resolver) + public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults(array( 'data_class' => 'VersionControl\GithubIssueBundle\Entity\Issues\IssueLabel' @@ -43,7 +43,7 @@ public function setDefaultOptions(OptionsResolverInterface $resolver) /** * @return string */ - public function getName() + public function getBlockPrefix() { return 'versioncontrol_gitcontrolbundle_issuelabel'; } diff --git a/src/VersionControl/GithubIssueBundle/Form/IssueMilestoneType.php b/src/VersionControl/GithubIssueBundle/Form/IssueMilestoneType.php index a804a60..c50ab6f 100755 --- a/src/VersionControl/GithubIssueBundle/Form/IssueMilestoneType.php +++ b/src/VersionControl/GithubIssueBundle/Form/IssueMilestoneType.php @@ -13,6 +13,8 @@ use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; +use Symfony\Component\Form\Extension\Core\Type\TextareaType; + class IssueMilestoneType extends AbstractType { /** @@ -23,7 +25,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) { $builder ->add('title') - ->add('description') + ->add('description',TextareaType::class) //->add('dueOn') ->add('dueOn', 'datetime', array('date_widget' => "single_text", 'time_widget' => "single_text" ,'required' => false,)) @@ -33,7 +35,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) /** * @param OptionsResolverInterface $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults(array( 'data_class' => 'VersionControl\GithubIssueBundle\Entity\Issues\IssueMilestone' @@ -44,7 +46,7 @@ public function configureOptions(OptionsResolver $resolver) /** * @return string */ - public function getName() + public function getBlockPrefix() { return 'versioncontrol_gitcontrolbundle_issuemilestone'; } diff --git a/src/VersionControl/GithubIssueBundle/Form/IssueType.php b/src/VersionControl/GithubIssueBundle/Form/IssueType.php index e46e259..3edf8ee 100755 --- a/src/VersionControl/GithubIssueBundle/Form/IssueType.php +++ b/src/VersionControl/GithubIssueBundle/Form/IssueType.php @@ -11,7 +11,10 @@ use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; -use Symfony\Component\OptionsResolver\OptionsResolverInterface; +use Symfony\Component\OptionsResolver\OptionsResolver; + +use Symfony\Component\Form\Extension\Core\Type\TextareaType; +use Symfony\Component\Form\Extension\Core\Type\ChoiceType; class IssueType extends AbstractType { @@ -30,7 +33,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) //$project = $builder->getData()->getProject(); $builder ->add('title') - ->add('description') + ->add('description',TextareaType::class) ->add('issueMilestone','choice',array( 'choices' => $this->getIssueMilestoneChoices(), 'multiple' => false, // Multiple selection allowed @@ -61,7 +64,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) // 'class' => 'VersionControl\GitControlBundle\Entity\Project' // )) //->add('verUser') - ->add('issueLabel','choice',array( + ->add('issueLabel',ChoiceType::class,array( 'choices' => $this->getIssueLabelChoices(), 'multiple' => true, // Multiple selection allowed 'expanded' => true, // Render as checkboxes @@ -106,7 +109,7 @@ protected function getIssueLabelChoices(){ /** * @param OptionsResolverInterface $resolver */ - public function setDefaultOptions(OptionsResolverInterface $resolver) + public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults(array( 'data_class' => 'VersionControl\GitControlBundle\Entity\Issues\Issue' @@ -116,7 +119,7 @@ public function setDefaultOptions(OptionsResolverInterface $resolver) /** * @return string */ - public function getName() + public function getBlockPrefix() { return 'versioncontrol_gitcontrolbundle_issue'; } diff --git a/src/VersionControl/GithubIssueBundle/Form/ProjectIssueIntegratorGithubType.php b/src/VersionControl/GithubIssueBundle/Form/ProjectIssueIntegratorGithubType.php index 3e49efe..56b70f5 100755 --- a/src/VersionControl/GithubIssueBundle/Form/ProjectIssueIntegratorGithubType.php +++ b/src/VersionControl/GithubIssueBundle/Form/ProjectIssueIntegratorGithubType.php @@ -11,7 +11,7 @@ use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; -use Symfony\Component\OptionsResolver\OptionsResolverInterface; +use Symfony\Component\OptionsResolver\OptionsResolver; class ProjectIssueIntegratorGithubType extends AbstractType { @@ -31,7 +31,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) /** * @param OptionsResolverInterface $resolver */ - public function setDefaultOptions(OptionsResolverInterface $resolver) + public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults(array( 'data_class' => 'VersionControl\GithubIssueBundle\Entity\ProjectIssueIntegratorGithub' @@ -41,7 +41,7 @@ public function setDefaultOptions(OptionsResolverInterface $resolver) /** * @return string */ - public function getName() + public function getBlockPrefix() { return 'versioncontrol_gitcontrolbundle_projectissueintegrator'; } diff --git a/src/VersionControl/GithubIssueBundle/Resources/config/services.yml b/src/VersionControl/GithubIssueBundle/Resources/config/services.yml index fce308e..876d479 100644 --- a/src/VersionControl/GithubIssueBundle/Resources/config/services.yml +++ b/src/VersionControl/GithubIssueBundle/Resources/config/services.yml @@ -13,18 +13,28 @@ services: class: VersionControl\GithubIssueBundle\Form\IssueType arguments: - @version_control.issue_repository_manager + tags: + - {name: 'form.type'} version_control.issue_form_edit_type.github: class: VersionControl\GithubIssueBundle\Form\IssueEditType arguments: - @version_control.issue_repository_manager + tags: + - {name: 'form.type'} version_control.issue_label_form_type.github: class: VersionControl\GithubIssueBundle\Form\IssueLabelType + tags: + - {name: 'form.type'} version_control.issue_comment_form_type.github: class: VersionControl\GithubIssueBundle\Form\IssueCommentType + tags: + - {name: 'form.type'} version_control.issue_milestone_form_type.github: class: VersionControl\GithubIssueBundle\Form\IssueMilestoneType + tags: + - {name: 'form.type'} diff --git a/src/VersionControl/GitlabIssueBundle/Controller/ProjectIssueIntegratorGitlabController.php b/src/VersionControl/GitlabIssueBundle/Controller/ProjectIssueIntegratorGitlabController.php index 55bc714..2347906 100755 --- a/src/VersionControl/GitlabIssueBundle/Controller/ProjectIssueIntegratorGitlabController.php +++ b/src/VersionControl/GitlabIssueBundle/Controller/ProjectIssueIntegratorGitlabController.php @@ -22,6 +22,8 @@ use VersionControl\GitlabIssueBundle\Form\ProjectIssueIntegratorGitlabNewType; use VersionControl\GitControlBundle\Annotation\ProjectAccess; +use Symfony\Component\Form\Extension\Core\Type\SubmitType; + /** * Project controller. * @@ -84,7 +86,7 @@ private function createCreateForm(ProjectIssueIntegrator $issueIntegrator) 'method' => 'POST', )); - $form->add('submit', 'submit', array('label' => 'Create')); + $form->add('submit', SubmitType::class, array('label' => 'Create')); return $form; } @@ -158,7 +160,7 @@ private function createEditForm(ProjectIssueIntegrator $issueIntegrator) 'method' => 'PUT', )); - $form->add('submit', 'submit', array('label' => 'Update')); + $form->add('submit', SubmitType::class, array('label' => 'Update')); return $form; } @@ -216,7 +218,7 @@ private function createDeleteForm($integratorId) return $this->createFormBuilder() ->setAction($this->generateUrl('project_issue_integrator_delete', array('id' => $this->project->getId(), 'integratorId' => $integratorId))) ->setMethod('DELETE') - ->add('submit', 'submit', array('label' => 'Delete')) + ->add('submit', SubmitType::class, array('label' => 'Delete')) ->getForm() ; } diff --git a/src/VersionControl/GitlabIssueBundle/Form/Field/GitlabProjectType.php b/src/VersionControl/GitlabIssueBundle/Form/Field/GitlabProjectType.php index 24c0c95..9b20043 100755 --- a/src/VersionControl/GitlabIssueBundle/Form/Field/GitlabProjectType.php +++ b/src/VersionControl/GitlabIssueBundle/Form/Field/GitlabProjectType.php @@ -11,7 +11,7 @@ use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; -use Symfony\Component\OptionsResolver\OptionsResolverInterface; +use Symfony\Component\OptionsResolver\OptionsResolver; use VersionControl\GitlabIssueBundle\Form\DataTransformer\IdToGitlabProjectTransformer; @@ -29,7 +29,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) $builder->addModelTransformer(new IdToGitlabProjectTransformer()); } - public function setDefaultOptions(OptionsResolverInterface $resolver) + public function configureOptions(OptionsResolver $resolver) { $resolver //->setRequired(array('class')) @@ -44,7 +44,7 @@ public function getParent() return 'choice'; } - public function getName() + public function getBlockPrefix() { return 'gitlab_project_choice'; } diff --git a/src/VersionControl/GitlabIssueBundle/Form/IssueCommentType.php b/src/VersionControl/GitlabIssueBundle/Form/IssueCommentType.php index 4b9caba..566ce84 100644 --- a/src/VersionControl/GitlabIssueBundle/Form/IssueCommentType.php +++ b/src/VersionControl/GitlabIssueBundle/Form/IssueCommentType.php @@ -11,7 +11,8 @@ use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; -use Symfony\Component\OptionsResolver\OptionsResolverInterface; +use Symfony\Component\OptionsResolver\OptionsResolver; +use Symfony\Component\Form\Extension\Core\Type\TextareaType; class IssueCommentType extends AbstractType { @@ -22,7 +23,7 @@ class IssueCommentType extends AbstractType public function buildForm(FormBuilderInterface $builder, array $options) { $builder - ->add('comment','textarea') + ->add('comment',TextareaType::class) //->add('issue', 'hidden_entity',array( // 'class' => 'VersionControl\GitlabIssueBundle\Entity\Issues\Issue' // )) @@ -31,9 +32,9 @@ public function buildForm(FormBuilderInterface $builder, array $options) } /** - * @param OptionsResolverInterface $resolver + * @inheritDoc */ - public function setDefaultOptions(OptionsResolverInterface $resolver) + public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults(array( 'data_class' => 'VersionControl\GitlabIssueBundle\Entity\Issues\IssueComment' @@ -43,7 +44,7 @@ public function setDefaultOptions(OptionsResolverInterface $resolver) /** * @return string */ - public function getName() + public function getBlockPrefix() { return 'versioncontrol_gitcontrolbundle_issuecomment'; } diff --git a/src/VersionControl/GitlabIssueBundle/Form/IssueEditType.php b/src/VersionControl/GitlabIssueBundle/Form/IssueEditType.php index f28b6cb..018028e 100644 --- a/src/VersionControl/GitlabIssueBundle/Form/IssueEditType.php +++ b/src/VersionControl/GitlabIssueBundle/Form/IssueEditType.php @@ -11,7 +11,10 @@ use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; -use Symfony\Component\OptionsResolver\OptionsResolverInterface; +use Symfony\Component\OptionsResolver\OptionsResolver; + +use Symfony\Component\Form\Extension\Core\Type\TextareaType; +use Symfony\Component\Form\Extension\Core\Type\ChoiceType; class IssueEditType extends AbstractType { @@ -30,13 +33,13 @@ public function buildForm(FormBuilderInterface $builder, array $options) { $builder ->add('title') - ->add('description','textarea') - ->add('status','choice',array('label' => 'State' + ->add('description',TextareaType::class) + ->add('status',ChoiceType::class,array('label' => 'State' ,'choices' => array('open' => 'Open', 'closed' => 'Close') ,'required' => false ,'empty_value' => 'Please select a State') ) - ->add('issueMilestone','choice',array( + ->add('issueMilestone',ChoiceType::class,array( 'choices' => $this->getIssueMilestoneChoices(), 'multiple' => false, // Multiple selection allowed //'expanded' => true, // Render as checkboxes @@ -62,7 +65,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) ->orderBy('a.id', 'ASC'); },*/ )) - ->add('issueLabel','choice',array( + ->add('issueLabel',ChoiceType::class,array( 'choices' => $this->getIssueLabelChoices(), 'multiple' => true, // Multiple selection allowed 'expanded' => true, // Render as checkboxes @@ -105,7 +108,7 @@ protected function getIssueLabelChoices(){ /** * @param OptionsResolverInterface $resolver */ - public function setDefaultOptions(OptionsResolverInterface $resolver) + public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults(array( 'data_class' => 'VersionControl\GitControlBundle\Entity\Issue' @@ -115,7 +118,7 @@ public function setDefaultOptions(OptionsResolverInterface $resolver) /** * @return string */ - public function getName() + public function getBlockPrefix() { return 'versioncontrol_gitcontrolbundle_issue'; } diff --git a/src/VersionControl/GitlabIssueBundle/Form/IssueLabelType.php b/src/VersionControl/GitlabIssueBundle/Form/IssueLabelType.php index c221256..7081052 100644 --- a/src/VersionControl/GitlabIssueBundle/Form/IssueLabelType.php +++ b/src/VersionControl/GitlabIssueBundle/Form/IssueLabelType.php @@ -11,7 +11,7 @@ use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; -use Symfony\Component\OptionsResolver\OptionsResolverInterface; +use Symfony\Component\OptionsResolver\OptionsResolver; class IssueLabelType extends AbstractType { @@ -33,7 +33,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) /** * @param OptionsResolverInterface $resolver */ - public function setDefaultOptions(OptionsResolverInterface $resolver) + public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults(array( 'data_class' => 'VersionControl\GitlabIssueBundle\Entity\Issues\IssueLabel' @@ -43,7 +43,7 @@ public function setDefaultOptions(OptionsResolverInterface $resolver) /** * @return string */ - public function getName() + public function getBlockPrefix() { return 'versioncontrol_gitcontrolbundle_issuelabel'; } diff --git a/src/VersionControl/GitlabIssueBundle/Form/IssueMilestoneType.php b/src/VersionControl/GitlabIssueBundle/Form/IssueMilestoneType.php index d3eef47..8cc08aa 100644 --- a/src/VersionControl/GitlabIssueBundle/Form/IssueMilestoneType.php +++ b/src/VersionControl/GitlabIssueBundle/Form/IssueMilestoneType.php @@ -13,6 +13,10 @@ use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; +use Symfony\Component\Form\Extension\Core\Type\DateTimeType; + + + class IssueMilestoneType extends AbstractType { /** @@ -25,7 +29,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) ->add('title') ->add('description') //->add('dueOn') - ->add('dueOn', 'datetime', array('date_widget' => "single_text", 'time_widget' => "single_text" ,'required' => false,)) + ->add('dueOn', DateTimeType::class, array('date_widget' => "single_text", 'time_widget' => "single_text" ,'required' => false,)) ; } @@ -33,7 +37,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) /** * @param OptionsResolverInterface $resolver */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults(array( 'data_class' => 'VersionControl\GitlabIssueBundle\Entity\Issues\IssueMilestone' @@ -44,7 +48,7 @@ public function configureOptions(OptionsResolver $resolver) /** * @return string */ - public function getName() + public function getBlockPrefix() { return 'versioncontrol_gitcontrolbundle_issuemilestone'; } diff --git a/src/VersionControl/GitlabIssueBundle/Form/IssueType.php b/src/VersionControl/GitlabIssueBundle/Form/IssueType.php index 65050a2..63edc59 100644 --- a/src/VersionControl/GitlabIssueBundle/Form/IssueType.php +++ b/src/VersionControl/GitlabIssueBundle/Form/IssueType.php @@ -11,7 +11,10 @@ use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; -use Symfony\Component\OptionsResolver\OptionsResolverInterface; +use Symfony\Component\OptionsResolver\OptionsResolver; + +use Symfony\Component\Form\Extension\Core\Type\TextareaType; +use Symfony\Component\Form\Extension\Core\Type\ChoiceType; class IssueType extends AbstractType { @@ -30,8 +33,8 @@ public function buildForm(FormBuilderInterface $builder, array $options) //$project = $builder->getData()->getProject(); $builder ->add('title') - ->add('description', 'textarea') - ->add('issueMilestone','choice',array( + ->add('description', TextareaType::class) + ->add('issueMilestone',ChoiceType::class,array( 'choices' => $this->getIssueMilestoneChoices(), 'multiple' => false, // Multiple selection allowed //'expanded' => true, // Render as checkboxes @@ -61,7 +64,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) // 'class' => 'VersionControl\GitControlBundle\Entity\Project' // )) //->add('verUser') - ->add('issueLabel','choice',array( + ->add('issueLabel',ChoiceType::class,array( 'choices' => $this->getIssueLabelChoices(), 'multiple' => true, // Multiple selection allowed 'expanded' => true, // Render as checkboxes @@ -106,7 +109,7 @@ protected function getIssueLabelChoices(){ /** * @param OptionsResolverInterface $resolver */ - public function setDefaultOptions(OptionsResolverInterface $resolver) + public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults(array( 'data_class' => 'VersionControl\GitControlBundle\Entity\Issues\Issue' @@ -116,7 +119,7 @@ public function setDefaultOptions(OptionsResolverInterface $resolver) /** * @return string */ - public function getName() + public function getBlockPrefix() { return 'versioncontrol_gitcontrolbundle_issue'; } diff --git a/src/VersionControl/GitlabIssueBundle/Form/ProjectIssueIntegratorGitlabNewType.php b/src/VersionControl/GitlabIssueBundle/Form/ProjectIssueIntegratorGitlabNewType.php index 6200d0d..12947eb 100755 --- a/src/VersionControl/GitlabIssueBundle/Form/ProjectIssueIntegratorGitlabNewType.php +++ b/src/VersionControl/GitlabIssueBundle/Form/ProjectIssueIntegratorGitlabNewType.php @@ -11,7 +11,7 @@ use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; -use Symfony\Component\OptionsResolver\OptionsResolverInterface; +use Symfony\Component\OptionsResolver\OptionsResolver; class ProjectIssueIntegratorGitlabNewType extends AbstractType { @@ -30,7 +30,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) /** * @param OptionsResolverInterface $resolver */ - public function setDefaultOptions(OptionsResolverInterface $resolver) + public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults(array( 'data_class' => 'VersionControl\GitlabIssueBundle\Entity\ProjectIssueIntegratorGitlab' @@ -40,7 +40,7 @@ public function setDefaultOptions(OptionsResolverInterface $resolver) /** * @return string */ - public function getName() + public function getBlockPrefix() { return 'versioncontrol_gitcontrolbundle_projectissueintegrator'; } diff --git a/src/VersionControl/GitlabIssueBundle/Form/ProjectIssueIntegratorGitlabType.php b/src/VersionControl/GitlabIssueBundle/Form/ProjectIssueIntegratorGitlabType.php index af6509a..187d8bd 100755 --- a/src/VersionControl/GitlabIssueBundle/Form/ProjectIssueIntegratorGitlabType.php +++ b/src/VersionControl/GitlabIssueBundle/Form/ProjectIssueIntegratorGitlabType.php @@ -11,7 +11,7 @@ use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; -use Symfony\Component\OptionsResolver\OptionsResolverInterface; +use Symfony\Component\OptionsResolver\OptionsResolver; use VersionControl\GitlabIssueBundle\Form\EventListener\AddProjectNameFieldSubscriber; class ProjectIssueIntegratorGitlabType extends AbstractType @@ -34,7 +34,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) /** * @param OptionsResolverInterface $resolver */ - public function setDefaultOptions(OptionsResolverInterface $resolver) + public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults(array( 'data_class' => 'VersionControl\GitlabIssueBundle\Entity\ProjectIssueIntegratorGitlab' @@ -45,7 +45,7 @@ public function setDefaultOptions(OptionsResolverInterface $resolver) /** * @return string */ - public function getName() + public function getBlockPrefix() { return 'versioncontrol_gitcontrolbundle_projectissueintegrator'; } diff --git a/src/VersionControl/GitlabIssueBundle/Resources/config/services.yml b/src/VersionControl/GitlabIssueBundle/Resources/config/services.yml index aee5f87..195f58e 100644 --- a/src/VersionControl/GitlabIssueBundle/Resources/config/services.yml +++ b/src/VersionControl/GitlabIssueBundle/Resources/config/services.yml @@ -13,20 +13,30 @@ services: class: VersionControl\GitlabIssueBundle\Form\IssueType arguments: - @version_control.issue_repository_manager + tags: + - {name: 'form.type'} version_control.issue_form_edit_type.gitlab: class: VersionControl\GitlabIssueBundle\Form\IssueEditType arguments: - @version_control.issue_repository_manager + tags: + - {name: 'form.type'} version_control.issue_label_form_type.gitlab: class: VersionControl\GitlabIssueBundle\Form\IssueLabelType + tags: + - {name: 'form.type'} version_control.issue_comment_form_type.gitlab: class: VersionControl\GitlabIssueBundle\Form\IssueCommentType + tags: + - {name: 'form.type'} version_control.issue_milestone_form_type.gitlab: class: VersionControl\GitlabIssueBundle\Form\IssueMilestoneType + tags: + - {name: 'form.type'} version_control.form.field.gitlab_project_choice: From 011079cfa53bbbbc651d881dc4286cfa021fa0e6 Mon Sep 17 00:00:00 2001 From: Paul Schweppe Date: Fri, 7 Oct 2016 08:05:01 +0100 Subject: [PATCH 03/60] Deprecation fixes --- .../Controller/Admin/IssueLabelAdminController.php | 4 ++-- .../Controller/ProjectEnvironmentController.php | 2 +- .../GitControlBundle/Controller/UserManagementController.php | 4 ++-- src/VersionControl/GitControlBundle/Entity/Project.php | 4 ---- .../GitControlBundle/Entity/ProjectEnvironment.php | 1 + .../GitControlBundle/Form/ProjectEnvironmentType.php | 2 +- 6 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/VersionControl/GitControlBundle/Controller/Admin/IssueLabelAdminController.php b/src/VersionControl/GitControlBundle/Controller/Admin/IssueLabelAdminController.php index c1802d5..9e9392d 100644 --- a/src/VersionControl/GitControlBundle/Controller/Admin/IssueLabelAdminController.php +++ b/src/VersionControl/GitControlBundle/Controller/Admin/IssueLabelAdminController.php @@ -84,7 +84,7 @@ public function createAction(Request $request) */ private function createCreateForm(IssueLabel $issue) { - $form = $this->createForm(new IssueLabelType(), $issue, array( + $form = $this->createForm(IssueLabelType::class, $issue, array( 'action' => $this->generateUrl('admin_issuelabel_create'), 'method' => 'POST', )); @@ -152,7 +152,7 @@ public function editAction($id) */ private function createEditForm(IssueLabel $issue) { - $form = $this->createForm(new IssueLabelType(), $issue, array( + $form = $this->createForm(IssueLabelType::class, $issue, array( 'action' => $this->generateUrl('admin_issuelabel_update', array('id' => $issue->getId())), 'method' => 'PUT', )); diff --git a/src/VersionControl/GitControlBundle/Controller/ProjectEnvironmentController.php b/src/VersionControl/GitControlBundle/Controller/ProjectEnvironmentController.php index b971eb3..a964e25 100644 --- a/src/VersionControl/GitControlBundle/Controller/ProjectEnvironmentController.php +++ b/src/VersionControl/GitControlBundle/Controller/ProjectEnvironmentController.php @@ -244,7 +244,7 @@ public function editAction($projectEnvironmentId) */ private function createEditForm(ProjectEnvironment $entity) { - $form = $this->createForm(new ProjectEnvironmentType(), $entity, array( + $form = $this->createForm(ProjectEnvironmentType::class, $entity, array( 'action' => $this->generateUrl('projectenvironment_update', array('projectEnvironmentId' => $entity->getId())), 'method' => 'PUT', )); diff --git a/src/VersionControl/GitControlBundle/Controller/UserManagementController.php b/src/VersionControl/GitControlBundle/Controller/UserManagementController.php index f00d204..356b27a 100644 --- a/src/VersionControl/GitControlBundle/Controller/UserManagementController.php +++ b/src/VersionControl/GitControlBundle/Controller/UserManagementController.php @@ -109,7 +109,7 @@ public function newAction() */ private function createCreateForm(User $user) { - $form = $this->createForm(new RegistrationType(), $user, array( + $form = $this->createForm(RegistrationType::class, $user, array( 'action' => $this->generateUrl('usermanagement_create'), 'method' => 'POST', )); @@ -157,7 +157,7 @@ public function editAction($id) */ private function createEditForm(User $entity) { - $form = $this->createForm(new EditUserType(), $entity, array( + $form = $this->createForm(EditUserType::class, $entity, array( 'action' => $this->generateUrl('usermanagement_update', array('id' => $entity->getId())), 'method' => 'PUT', )); diff --git a/src/VersionControl/GitControlBundle/Entity/Project.php b/src/VersionControl/GitControlBundle/Entity/Project.php index 9f1e6a3..92a38d4 100644 --- a/src/VersionControl/GitControlBundle/Entity/Project.php +++ b/src/VersionControl/GitControlBundle/Entity/Project.php @@ -94,10 +94,6 @@ class Project * * @ORM\OneToMany(targetEntity="VersionControl\GitControlBundle\Entity\ProjectEnvironment", mappedBy="project", cascade={"persist"}, orphanRemoval=true ) * @Assert\Valid - * @Assert\Count( - * min = "1", - * minMessage = "validate.resourceCurriculum.min", - * groups={"publish"}) */ private $projectEnvironment; diff --git a/src/VersionControl/GitControlBundle/Entity/ProjectEnvironment.php b/src/VersionControl/GitControlBundle/Entity/ProjectEnvironment.php index 66ecba6..7fb2e1e 100644 --- a/src/VersionControl/GitControlBundle/Entity/ProjectEnvironment.php +++ b/src/VersionControl/GitControlBundle/Entity/ProjectEnvironment.php @@ -108,6 +108,7 @@ class ProjectEnvironment implements GitEnvironmentInterface * @ORM\JoinColumns({ * @ORM\JoinColumn(name="project_environment_file_perm_id", referencedColumnName="id") * }) + * @Assert\Valid */ private $projectEnvironmentFilePerm; diff --git a/src/VersionControl/GitControlBundle/Form/ProjectEnvironmentType.php b/src/VersionControl/GitControlBundle/Form/ProjectEnvironmentType.php index 8c9551f..213b1ee 100644 --- a/src/VersionControl/GitControlBundle/Form/ProjectEnvironmentType.php +++ b/src/VersionControl/GitControlBundle/Form/ProjectEnvironmentType.php @@ -45,7 +45,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) ->add('password',PasswordType::class,array('required' => false)) ->add('privateKey',TextareaType::class,array('required' => false)) ->add('privateKeyPassword',PasswordType::class,array('required' => false)) - ->add('projectEnvironmentFilePerm', new ProjectEnvironmentFilePermType(), array('required' => false)); + ->add('projectEnvironmentFilePerm', ProjectEnvironmentFilePermType::class, array('required' => false)); if($this->useCloneLocation === true){ $builder->add('gitCloneLocation',TextType::class,array('required' => false)) ; From 492f5dac2e759639818ccd23879e333a7af30b21 Mon Sep 17 00:00:00 2001 From: Paul Schweppe Date: Fri, 7 Oct 2016 15:07:07 +0100 Subject: [PATCH 04/60] Deprecation fixes --- app/config/config.yml | 3 +- app/config/security.yml | 4 +- app/config/services.yml | 4 +- .../GitCommands/Command/GitDiffCommand.php | 8 ++- .../Resources/config/services.yml | 6 +-- .../Controller/ProjectHistoryController.php | 2 +- .../Controller/UserProjectsController.php | 8 +-- .../Form/EditUserProjectsType.php | 6 +-- .../GitControlBundle/Form/EditUserType.php | 3 +- .../Form/IssueCommentType.php | 3 +- .../GitControlBundle/Form/IssueEditType.php | 4 +- .../GitControlBundle/Form/IssueLabelType.php | 3 +- .../Form/IssueMilestoneType.php | 3 +- .../GitControlBundle/Form/IssueType.php | 5 +- .../Form/ProjectIssueIntegratorType.php | 5 +- .../Form/UserProjectsType.php | 39 ++++---------- .../Resources/config/gitservices.yml | 10 ++-- .../Resources/config/services.yml | 52 +++++++++---------- .../Constraints/GitFolderExistsValidator.php | 4 +- .../GitFolderNotExistsValidator.php | 6 +-- .../Constraints/SshDetailsValidator.php | 4 +- .../Constraints/StatusHashValidator.php | 4 +- .../Resources/config/services.yml | 4 +- ...ProjectIssueIntegratorGitlabController.php | 2 +- .../AddProjectNameFieldSubscriber.php | 3 +- .../Form/Field/GitlabProjectType.php | 3 +- .../Resources/config/services.yml | 7 ++- 27 files changed, 98 insertions(+), 107 deletions(-) diff --git a/app/config/config.yml b/app/config/config.yml index 403e6f6..c807806 100755 --- a/app/config/config.yml +++ b/app/config/config.yml @@ -32,8 +32,7 @@ twig: strict_variables: "%kernel.debug%" globals: enable_registration: %enable_registration% - form: - resources: ['bootstrap_3_layout.html.twig'] + form_themes : ['bootstrap_3_layout.html.twig'] # Assetic Configuration assetic: diff --git a/app/config/security.yml b/app/config/security.yml index 6b616af..5bfedd5 100755 --- a/app/config/security.yml +++ b/app/config/security.yml @@ -20,11 +20,11 @@ security: pattern: ^/ form_login: provider: fos_userbundle - csrf_provider: security.csrf.token_manager + csrf_token_generator: security.csrf.token_manager logout: true anonymous: true remember_me: - key: "%secret%" + secret: "%secret%" lifetime: 2592000 path: / domain: ~ diff --git a/app/config/services.yml b/app/config/services.yml index 0015ebd..f140d6c 100755 --- a/app/config/services.yml +++ b/app/config/services.yml @@ -3,13 +3,13 @@ services: lrotherfield.form.type.hidden_entity: class: Lrotherfield\Component\Form\Type\HiddenEntityType arguments: - - @doctrine.orm.entity_manager + - '@doctrine.orm.entity_manager' tags: - { name: form.type, alias: hidden_entity } salavert.twig.time_ago: class: Salavert\Twig\Extension\TimeAgoExtension - arguments: [@translator] + arguments: ['@translator'] tags: - { name: twig.extension } diff --git a/src/VersionControl/GitCommandBundle/GitCommands/Command/GitDiffCommand.php b/src/VersionControl/GitCommandBundle/GitCommands/Command/GitDiffCommand.php index 5a02dcc..883cd87 100644 --- a/src/VersionControl/GitCommandBundle/GitCommands/Command/GitDiffCommand.php +++ b/src/VersionControl/GitCommandBundle/GitCommands/Command/GitDiffCommand.php @@ -70,9 +70,13 @@ public function getFilesInCommit($commitHash){ return $files; } - public function getPreviousCommitHash($commitHash = 'HEAD'){ + public function getPreviousCommitHash($commitHash = 'HEAD',$fileName = false){ $previousCommitHash = ''; - $response = $this->command->runCommand(" git log --pretty=format:'%h' -n 2 ".escapeshellarg($commitHash).""); + $command = " git log --pretty=format:'%h' -n 2 ".escapeshellarg($commitHash).""; + if($fileName !== false){ + $command .= " ".escapeshellarg($fileName); + } + $response = $this->command->runCommand($command); $responseLines = $this->splitOnNewLine($response); if(count($responseLines) == 2){ $previousCommitHash = trim($responseLines['1']); diff --git a/src/VersionControl/GitCommandBundle/Resources/config/services.yml b/src/VersionControl/GitCommandBundle/Resources/config/services.yml index d319490..98f3b64 100644 --- a/src/VersionControl/GitCommandBundle/Resources/config/services.yml +++ b/src/VersionControl/GitCommandBundle/Resources/config/services.yml @@ -26,13 +26,13 @@ services: #priority: 300 public: false arguments: - - @version_control.logger + - '@version_control.logger' version_control.logger: class: VersionControl\GitCommandBundle\Logger\GitCommandLogger arguments: - - @logger + - '@logger' - %kernel.debug% tags: - { name: monolog.logger, channel: 'gitcommand' } @@ -42,5 +42,5 @@ services: tags: - { name: twig.extension } arguments: - - @version_control.git_commands + - '@version_control.git_commands' diff --git a/src/VersionControl/GitControlBundle/Controller/ProjectHistoryController.php b/src/VersionControl/GitControlBundle/Controller/ProjectHistoryController.php index 7ea9506..27f5f0d 100644 --- a/src/VersionControl/GitControlBundle/Controller/ProjectHistoryController.php +++ b/src/VersionControl/GitControlBundle/Controller/ProjectHistoryController.php @@ -164,7 +164,7 @@ public function fileDiffAction($id,$commitHash,$filePath){ $difffile = urldecode($filePath); - $previousCommitHash = $gitDiffCommand->getPreviousCommitHash($commitHash); + $previousCommitHash = $gitDiffCommand->getPreviousCommitHash($commitHash,$difffile); $gitDiffs = $gitDiffCommand->getDiffFileBetweenCommits($difffile,$previousCommitHash,$commitHash); diff --git a/src/VersionControl/GitControlBundle/Controller/UserProjectsController.php b/src/VersionControl/GitControlBundle/Controller/UserProjectsController.php index cb2d452..b85a043 100644 --- a/src/VersionControl/GitControlBundle/Controller/UserProjectsController.php +++ b/src/VersionControl/GitControlBundle/Controller/UserProjectsController.php @@ -119,10 +119,11 @@ public function createAction(Request $request,$id) */ private function createCreateForm(UserProjects $entity,$project) { - $userProjectsType = new UserProjectsType; - $form = $this->createForm($userProjectsType->setProjectId($project->getId()), $entity, array( + + $form = $this->createForm(UserProjectsType::class, $entity, array( 'action' => $this->generateUrl('userprojects_create', array('id' => $project->getId())), 'method' => 'POST', + 'projectId' => $project->getId() )); $form->add('submit', SubmitType::class, array('label' => 'Add')); @@ -149,7 +150,8 @@ private function createEditForm() 'label' => 'User Role' ,'choices' => array('Reporter' => 'Reporter', 'Developer' => 'Developer', 'Master' => 'Master') ,'required' => false - ,'empty_value' => 'Please select a role' + ,'placeholder' => 'Please select a role' + ,'choices_as_values' => true ,'constraints' => array( new NotBlank() ) diff --git a/src/VersionControl/GitControlBundle/Form/EditUserProjectsType.php b/src/VersionControl/GitControlBundle/Form/EditUserProjectsType.php index 4cb4c06..83cde8e 100644 --- a/src/VersionControl/GitControlBundle/Form/EditUserProjectsType.php +++ b/src/VersionControl/GitControlBundle/Form/EditUserProjectsType.php @@ -15,7 +15,7 @@ use Doctrine\ORM\EntityRepository; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; - +use Lrotherfield\Component\Form\Type\HiddenEntityType; class EditUserProjectsType extends AbstractType { @@ -34,9 +34,9 @@ public function buildForm(FormBuilderInterface $builder, array $options) 'label' => 'User Role' ,'choices' => array('Reporter' => 'Reporter', 'Developer' => 'Developer', 'Master' => 'Master') ,'required' => false - ,'empty_value' => 'Please select a role' + ,'placeholder' => 'Please select a role' )) - ->add('project', 'hidden_entity',array( + ->add('project', HiddenEntityType::class,array( 'class' => 'VersionControl\GitControlBundle\Entity\Project' )) ; diff --git a/src/VersionControl/GitControlBundle/Form/EditUserType.php b/src/VersionControl/GitControlBundle/Form/EditUserType.php index 9f841ea..b9e5b27 100644 --- a/src/VersionControl/GitControlBundle/Form/EditUserType.php +++ b/src/VersionControl/GitControlBundle/Form/EditUserType.php @@ -14,6 +14,7 @@ use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\Extension\Core\Type\CheckboxType; +use FOS\UserBundle\Form\Type\ProfileFormType; class EditUserType extends AbstractType @@ -30,7 +31,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) public function getParent() { - return 'fos_user_profile'; + return ProfileFormType::class; } public function getBlockPrefix() diff --git a/src/VersionControl/GitControlBundle/Form/IssueCommentType.php b/src/VersionControl/GitControlBundle/Form/IssueCommentType.php index 70af4d8..0ffdea4 100644 --- a/src/VersionControl/GitControlBundle/Form/IssueCommentType.php +++ b/src/VersionControl/GitControlBundle/Form/IssueCommentType.php @@ -12,6 +12,7 @@ use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; +use Lrotherfield\Component\Form\Type\HiddenEntityType; class IssueCommentType extends AbstractType { @@ -23,7 +24,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) { $builder ->add('comment') - ->add('issue', 'hidden_entity',array( + ->add('issue', HiddenEntityType::class,array( 'class' => 'VersionControl\GitControlBundle\Entity\Issue' )) diff --git a/src/VersionControl/GitControlBundle/Form/IssueEditType.php b/src/VersionControl/GitControlBundle/Form/IssueEditType.php index 1182688..a4e34fe 100644 --- a/src/VersionControl/GitControlBundle/Form/IssueEditType.php +++ b/src/VersionControl/GitControlBundle/Form/IssueEditType.php @@ -14,7 +14,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; -use Symfony\Component\Form\Extension\Core\Type\EntityType; +use Symfony\Bridge\Doctrine\Form\Type\EntityType; class IssueEditType extends AbstractType @@ -31,7 +31,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) ->add('status',ChoiceType::class,array('label' => 'State' ,'choices' => array('open' => 'Open', 'closed' => 'Close') ,'required' => false - ,'empty_value' => 'Please select a State') + ,'placeholder' => 'Please select a State') ) ->add('issueMilestone',EntityType::class,array( 'multiple' => false, // Multiple selection allowed diff --git a/src/VersionControl/GitControlBundle/Form/IssueLabelType.php b/src/VersionControl/GitControlBundle/Form/IssueLabelType.php index b87dc6f..aa06e73 100644 --- a/src/VersionControl/GitControlBundle/Form/IssueLabelType.php +++ b/src/VersionControl/GitControlBundle/Form/IssueLabelType.php @@ -12,6 +12,7 @@ use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; +use Lrotherfield\Component\Form\Type\HiddenEntityType; class IssueLabelType extends AbstractType { @@ -24,7 +25,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) $builder ->add('title') ->add('hexColor') - ->add('project', 'hidden_entity',array( + ->add('project', HiddenEntityType::class,array( 'class' => 'VersionControl\GitControlBundle\Entity\Project' )) ; diff --git a/src/VersionControl/GitControlBundle/Form/IssueMilestoneType.php b/src/VersionControl/GitControlBundle/Form/IssueMilestoneType.php index 99bc5af..4050fd0 100644 --- a/src/VersionControl/GitControlBundle/Form/IssueMilestoneType.php +++ b/src/VersionControl/GitControlBundle/Form/IssueMilestoneType.php @@ -15,6 +15,7 @@ use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\Extension\Core\Type\DateTimeType; +use Lrotherfield\Component\Form\Type\HiddenEntityType; class IssueMilestoneType extends AbstractType { @@ -30,7 +31,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) //->add('dueOn') ->add('dueOn', DateTimeType::class, array('date_widget' => "single_text", 'time_widget' => "single_text" ,'required' => false,)) - ->add('project', 'hidden_entity',array( + ->add('project', HiddenEntityType::class,array( 'class' => 'VersionControl\GitControlBundle\Entity\Project' )) ; diff --git a/src/VersionControl/GitControlBundle/Form/IssueType.php b/src/VersionControl/GitControlBundle/Form/IssueType.php index 3aa7ab0..00dee05 100644 --- a/src/VersionControl/GitControlBundle/Form/IssueType.php +++ b/src/VersionControl/GitControlBundle/Form/IssueType.php @@ -21,7 +21,8 @@ use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\Extension\Core\Type\PasswordType; use Symfony\Component\Form\Extension\Core\Type\TextareaType; -use Symfony\Component\Form\Extension\Core\Type\EntityType; +use Symfony\Bridge\Doctrine\Form\Type\EntityType; +use Lrotherfield\Component\Form\Type\HiddenEntityType; class IssueType extends AbstractType { @@ -54,7 +55,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) ->orderBy('a.id', 'ASC'); }, )) - ->add('project', 'hidden_entity',array( + ->add('project', HiddenEntityType::class,array( 'class' => 'VersionControl\GitControlBundle\Entity\Project' )) //->add('verUser') diff --git a/src/VersionControl/GitControlBundle/Form/ProjectIssueIntegratorType.php b/src/VersionControl/GitControlBundle/Form/ProjectIssueIntegratorType.php index 900d753..efc536a 100644 --- a/src/VersionControl/GitControlBundle/Form/ProjectIssueIntegratorType.php +++ b/src/VersionControl/GitControlBundle/Form/ProjectIssueIntegratorType.php @@ -13,8 +13,9 @@ use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\Form\Extension\Core\Type\TextType; -use Symfony\Component\Form\Extension\Core\Type\EntityType; +use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; +use Lrotherfield\Component\Form\Type\HiddenEntityType; class ProjectIssueIntegratorType extends AbstractType { @@ -38,7 +39,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) ->add('ownerName') ->add('apiToken') ->add('url') - ->add('project', 'hidden_entity',array( + ->add('project', HiddenEntityType::class,array( 'class' => 'VersionControl\GitControlBundle\Entity\Project' )) ; diff --git a/src/VersionControl/GitControlBundle/Form/UserProjectsType.php b/src/VersionControl/GitControlBundle/Form/UserProjectsType.php index efe2c65..3d24dac 100644 --- a/src/VersionControl/GitControlBundle/Form/UserProjectsType.php +++ b/src/VersionControl/GitControlBundle/Form/UserProjectsType.php @@ -14,18 +14,13 @@ use Symfony\Component\OptionsResolver\OptionsResolver; use Doctrine\ORM\EntityRepository; use Symfony\Component\Form\Extension\Core\Type\TextType; -use Symfony\Component\Form\Extension\Core\Type\EntityType; +use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; +use Lrotherfield\Component\Form\Type\HiddenEntityType; class UserProjectsType extends AbstractType { - /** - * Project Id. Used in query to select all user not apart of this project already - * - * @var integer - */ - protected $projectId; /** * @param FormBuilderInterface $builder @@ -33,18 +28,20 @@ class UserProjectsType extends AbstractType */ public function buildForm(FormBuilderInterface $builder, array $options) { - $projectId = $this->getProjectId(); + $projectId = $options['projectId']; + $builder ->add('roles',ChoiceType::class, array( 'label' => 'User Role' ,'choices' => array('Reporter' => 'Reporter', 'Developer' => 'Developer', 'Master' => 'Master') ,'required' => false - ,'empty_value' => 'Please select a role' + ,'placeholder' => 'Please select a role' + ,'choices_as_values' => true )) ->add('user',EntityType::class, array( 'class' => 'VersionControl\GitControlBundle\Entity\User\User', 'choice_label' => 'username', - 'empty_value' => 'Please select a user', + 'placeholder' => 'Please select a user', 'query_builder' => function(EntityRepository $er) use($projectId) { $qb = $er->createQueryBuilder('a'); @@ -60,7 +57,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) ->orderBy('u.username', 'ASC'); }, )) - ->add('project', 'hidden_entity',array( + ->add('project', HiddenEntityType::class,array( 'class' => 'VersionControl\GitControlBundle\Entity\Project' )) ; @@ -72,7 +69,8 @@ public function buildForm(FormBuilderInterface $builder, array $options) public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults(array( - 'data_class' => 'VersionControl\GitControlBundle\Entity\UserProjects' + 'data_class' => 'VersionControl\GitControlBundle\Entity\UserProjects', + 'projectId' => null )); } @@ -84,23 +82,6 @@ public function getBlockPrefix() return 'versioncontrol_gitcontrolbundle_userprojects'; } - /** - * Gets the project Id - * @return integer - */ - public function getProjectId() { - return $this->projectId; - } - - /** - * Sets the project Id - * @param integer $projectId - * @return \VersionControl\GitControlBundle\Form\UserProjectsType - */ - public function setProjectId($projectId) { - $this->projectId = $projectId; - return $this; - } } diff --git a/src/VersionControl/GitControlBundle/Resources/config/gitservices.yml b/src/VersionControl/GitControlBundle/Resources/config/gitservices.yml index f97ce7d..e980dc0 100644 --- a/src/VersionControl/GitControlBundle/Resources/config/gitservices.yml +++ b/src/VersionControl/GitControlBundle/Resources/config/gitservices.yml @@ -22,13 +22,13 @@ services: #priority: 300 public: false arguments: - - @version_control.logger + - '@version_control.logger' version_control.logger: class: VersionControl\GitControlBundle\Logger\GitCommandLogger arguments: - - @logger + - '@logger' - %kernel.debug% tags: - { name: monolog.logger, channel: 'gitcommand' } @@ -36,7 +36,7 @@ services: version_control.issue_repository_manager: class: VersionControl\GitControlBundle\Repository\Issues\IssueRepositoryManager arguments: - - @security.token_storage - - @doctrine.orm.entity_manager - - @service_container + - '@security.token_storage' + - '@doctrine.orm.entity_manager' + - '@service_container' \ No newline at end of file diff --git a/src/VersionControl/GitControlBundle/Resources/config/services.yml b/src/VersionControl/GitControlBundle/Resources/config/services.yml index b0a35ec..a93568a 100644 --- a/src/VersionControl/GitControlBundle/Resources/config/services.yml +++ b/src/VersionControl/GitControlBundle/Resources/config/services.yml @@ -7,7 +7,7 @@ services: version_control.subscriberACL: class: VersionControl\GitControlBundle\EventListener\ProjectAccessControlList - arguments: [@service_container] + arguments: ['@service_container'] tags: - { name: doctrine.event_subscriber } @@ -25,15 +25,15 @@ services: version_control.project_environmnent_storage: class: VersionControl\GitControlBundle\Utility\ProjectEnvironmentStorage arguments: - - @session - - @doctrine.orm.entity_manager + - '@session' + - '@doctrine.orm.entity_manager' version_control.twig.versioncontrol_project_environmnent_storage: class: VersionControl\GitControlBundle\Twig\Extension\ProjectEnvironmnentStorageExtension tags: - { name: twig.extension } arguments: - - @version_control.project_environmnent_storage + - '@version_control.project_environmnent_storage' version_control.twig.versioncontrol_parentdirectory: class: VersionControl\GitControlBundle\Twig\Extension\ParentDirectoryExtension @@ -46,48 +46,48 @@ services: tags: - { name: twig.extension } arguments: - - @router - - @request_stack + - '@router' + - '@request_stack' version_control.issue_repository_manager: class: VersionControl\GitControlBundle\Repository\Issues\IssueRepositoryManager arguments: - - @security.token_storage - - @doctrine.orm.entity_manager - - @service_container + - '@security.token_storage' + - '@doctrine.orm.entity_manager' + - '@service_container' version_control.twig.versioncontrol_issuelink: class: VersionControl\GitControlBundle\Twig\Extension\IssueLinkExtension tags: - { name: twig.extension } arguments: - - @router + - '@router' version_control.twig.versioncontrol_commit_hash_link: class: VersionControl\GitControlBundle\Twig\Extension\CommitHashLinkExtension tags: - { name: twig.extension } arguments: - - @router + - '@router' version_control.twig.versioncontrol_issue_number_link: class: VersionControl\GitControlBundle\Twig\Extension\IssueNumberLinkExtension tags: - { name: twig.extension } arguments: - - @router + - '@router' version_control.beforecontoller.action_listener: class: VersionControl\GitControlBundle\EventListener\ProjectEnviromentBeforeListener arguments: - - @version_control.project_environmnent_storage + - '@version_control.project_environmnent_storage' tags: - { name: kernel.event_listener, event: kernel.controller, method: onKernelController } version_control.gitalterfiles.listener: class: VersionControl\GitControlBundle\EventListener\GitAlterFilesEventListener arguments: - - @version_control.git_commands + - '@version_control.git_commands' tags: - { name: kernel.event_listener, event: git.alter_files, method: changeFilePermissions } @@ -96,13 +96,13 @@ services: tags: - { name: validator.constraint_validator, alias: ssh_details_validator } arguments: - - @version_control.sftp_process + - '@version_control.sftp_process' version_control.api_user_provider: class: VersionControl\GitControlBundle\Security\Authentication\FOSVersionUserProvider #this is the place where the properties are passed to the UserProvider - see config.yml arguments: - - @fos_user.user_manager + - '@fos_user.user_manager' - {github:githubId} version_control.validator.status_hash_validator: @@ -110,8 +110,8 @@ services: tags: - { name: validator.constraint_validator, alias: status_hash_validator } arguments: - - @version_control.git_commands - - @version_control.project_environmnent_storage + - '@version_control.git_commands' + - '@version_control.project_environmnent_storage' version_control.form.field.entity_hidden: class: VersionControl\GitControlBundle\Form\Field\EntityHiddenType @@ -124,14 +124,14 @@ services: tags: - { name: validator.constraint_validator, alias: git_folder_exists_validator } arguments: - - @version_control.sftp_process + - '@version_control.sftp_process' version_control.validator.git_folder_not_exists_validator: class: VersionControl\GitControlBundle\Validator\Constraints\GitFolderNotExistsValidator tags: - { name: validator.constraint_validator, alias: git_folder_not_exists_validator } arguments: - - @version_control.ssh_process + - '@version_control.ssh_process' version_control.listener.doctrine_event_listener: @@ -143,21 +143,21 @@ services: version_control.project_access_annotation_driver: class: VersionControl\GitControlBundle\Annotation\Driver\ProjectAccessAnnotationDriver #Point class tags: [{name: kernel.event_listener, event: kernel.controller, method: onKernelController}] - arguments: [@annotation_reader] + arguments: ['@annotation_reader'] version_control.installer.db_install: class: VersionControl\GitControlBundle\Installer\DatabaseInstall - arguments: [@database_connection] + arguments: ['@database_connection'] tags: - {name: version_control.installer, type: initaldb} version_control.installer_command: class: VersionControl\GitControlBundle\Command\InstallerCommand arguments: - - @database_connection - - @version_control.installer.db_install - - @cache_clearer - - @filesystem + - '@database_connection' + - '@version_control.installer.db_install' + - '@cache_clearer' + - '@filesystem' - %kernel.cache_dir% - %kernel.environment% tags: diff --git a/src/VersionControl/GitControlBundle/Validator/Constraints/GitFolderExistsValidator.php b/src/VersionControl/GitControlBundle/Validator/Constraints/GitFolderExistsValidator.php index b6d9c17..dcd42fc 100644 --- a/src/VersionControl/GitControlBundle/Validator/Constraints/GitFolderExistsValidator.php +++ b/src/VersionControl/GitControlBundle/Validator/Constraints/GitFolderExistsValidator.php @@ -44,13 +44,13 @@ public function validate($projectEnvironment, Constraint $constraint) try{ if ($this->sftpProcess->fileExists($gitPath.'/.git') === false){ - $this->context->buildViolation($constraint->message) + $this->context->buildViolation($constraint->getMessage()) ->atPath('path') ->addViolation(); } }catch(SshLoginException $sshLoginException){ - $this->context->buildViolation($sshLoginException->message) + $this->context->buildViolation($sshLoginException->getMessage()) ->atPath('path') ->addViolation(); } diff --git a/src/VersionControl/GitControlBundle/Validator/Constraints/GitFolderNotExistsValidator.php b/src/VersionControl/GitControlBundle/Validator/Constraints/GitFolderNotExistsValidator.php index 6192381..76fe071 100644 --- a/src/VersionControl/GitControlBundle/Validator/Constraints/GitFolderNotExistsValidator.php +++ b/src/VersionControl/GitControlBundle/Validator/Constraints/GitFolderNotExistsValidator.php @@ -43,13 +43,13 @@ public function validate($projectEnvironment, Constraint $constraint) $this->sftpProcess->setGitEnviroment($projectEnvironment); try{ if ($this->sftpProcess->fileExists($gitPath.'/.git') === true){ - $this->context->buildViolation($constraint->message) + $this->context->buildViolation($constraint->getMessage()) ->atPath('path') ->addViolation(); } } catch(SshLoginException $sshLoginException){ - $this->context->buildViolation($sshLoginException->message) + $this->context->buildViolation($sshLoginException->getMessage()) ->atPath('path') ->addViolation(); } @@ -62,7 +62,7 @@ public function validate($projectEnvironment, Constraint $constraint) }else{ if (file_exists($gitPath.'/.git') === true){ - $this->context->buildViolation($constraint->message) + $this->context->buildViolation($constraint->getMessage()) ->atPath('path') ->addViolation(); } diff --git a/src/VersionControl/GitControlBundle/Validator/Constraints/SshDetailsValidator.php b/src/VersionControl/GitControlBundle/Validator/Constraints/SshDetailsValidator.php index 41a491e..a6a8785 100644 --- a/src/VersionControl/GitControlBundle/Validator/Constraints/SshDetailsValidator.php +++ b/src/VersionControl/GitControlBundle/Validator/Constraints/SshDetailsValidator.php @@ -52,11 +52,11 @@ public function validate($projectEnvironment, Constraint $constraint) ->addViolation(); } } catch(SshLoginException $sshLoginException){ - $this->context->buildViolation($sshLoginException->message) + $this->context->buildViolation($sshLoginException->getMessage()) ->atPath('title') ->addViolation(); } catch (\Exception $ex) { - $this->context->buildViolation($constraint->message) + $this->context->buildViolation($constraint->getMessage()) ->atPath('title') ->addViolation(); diff --git a/src/VersionControl/GitControlBundle/Validator/Constraints/StatusHashValidator.php b/src/VersionControl/GitControlBundle/Validator/Constraints/StatusHashValidator.php index f2dde4f..cc8af3a 100644 --- a/src/VersionControl/GitControlBundle/Validator/Constraints/StatusHashValidator.php +++ b/src/VersionControl/GitControlBundle/Validator/Constraints/StatusHashValidator.php @@ -42,10 +42,8 @@ public function validate($commitEntity, Constraint $constraint) $currentStatusHash = $this->gitStatusCommand->getStatusHash(); - print_r($currentStatusHash); - print_r('
'.$statusHash); if($currentStatusHash !== $statusHash){ - $this->context->buildViolation($constraint->message) + $this->context->buildViolation($constraint->getMessage()) ->setParameter('{{statushash}}', $statusHash) ->setParameter('{{currentstatushash}}', $currentStatusHash) ->atPath('files') diff --git a/src/VersionControl/GithubIssueBundle/Resources/config/services.yml b/src/VersionControl/GithubIssueBundle/Resources/config/services.yml index 876d479..983a350 100644 --- a/src/VersionControl/GithubIssueBundle/Resources/config/services.yml +++ b/src/VersionControl/GithubIssueBundle/Resources/config/services.yml @@ -12,14 +12,14 @@ services: version_control.issue_form_type.github: class: VersionControl\GithubIssueBundle\Form\IssueType arguments: - - @version_control.issue_repository_manager + - '@version_control.issue_repository_manager' tags: - {name: 'form.type'} version_control.issue_form_edit_type.github: class: VersionControl\GithubIssueBundle\Form\IssueEditType arguments: - - @version_control.issue_repository_manager + - '@version_control.issue_repository_manager' tags: - {name: 'form.type'} diff --git a/src/VersionControl/GitlabIssueBundle/Controller/ProjectIssueIntegratorGitlabController.php b/src/VersionControl/GitlabIssueBundle/Controller/ProjectIssueIntegratorGitlabController.php index 2347906..f7b61b8 100755 --- a/src/VersionControl/GitlabIssueBundle/Controller/ProjectIssueIntegratorGitlabController.php +++ b/src/VersionControl/GitlabIssueBundle/Controller/ProjectIssueIntegratorGitlabController.php @@ -155,7 +155,7 @@ public function editAction($id,$integratorId) */ private function createEditForm(ProjectIssueIntegrator $issueIntegrator) { - $form = $this->createForm(new ProjectIssueIntegratorGitlabType(), $issueIntegrator, array( + $form = $this->createForm(ProjectIssueIntegratorGitlabType::class, $issueIntegrator, array( 'action' => $this->generateUrl('project_issue_integrator_gitlab_update', array('integratorId' => $issueIntegrator->getId(),'id' => $this->project->getId())), 'method' => 'PUT', )); diff --git a/src/VersionControl/GitlabIssueBundle/Form/EventListener/AddProjectNameFieldSubscriber.php b/src/VersionControl/GitlabIssueBundle/Form/EventListener/AddProjectNameFieldSubscriber.php index b056cfe..44ecaad 100644 --- a/src/VersionControl/GitlabIssueBundle/Form/EventListener/AddProjectNameFieldSubscriber.php +++ b/src/VersionControl/GitlabIssueBundle/Form/EventListener/AddProjectNameFieldSubscriber.php @@ -14,6 +14,7 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\Form\Extension\Core\Type\TextType; use VersionControl\GitlabIssueBundle\DataTransformer\GitlabProjectToEntityTransformer; +use VersionControl\GitlabIssueBundle\Form\Field\GitlabProjectType; class AddProjectNameFieldSubscriber implements EventSubscriberInterface @@ -34,7 +35,7 @@ public function preSetData(FormEvent $event) if ($projectIssueIntegratorGitlab && $projectIssueIntegratorGitlab instanceof \VersionControl\GitlabIssueBundle\Entity\ProjectIssueIntegratorGitlab) { - $form->add('projectName','gitlab_project_choice',array( + $form->add('projectName',GitlabProjectType::class,array( 'choices' => $this->getProjectChoices($projectIssueIntegratorGitlab), 'multiple' => false, // Multiple selection allowed 'placeholder' => 'Choose a projecton Gitlab', diff --git a/src/VersionControl/GitlabIssueBundle/Form/Field/GitlabProjectType.php b/src/VersionControl/GitlabIssueBundle/Form/Field/GitlabProjectType.php index 9b20043..287cec5 100755 --- a/src/VersionControl/GitlabIssueBundle/Form/Field/GitlabProjectType.php +++ b/src/VersionControl/GitlabIssueBundle/Form/Field/GitlabProjectType.php @@ -14,6 +14,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver; use VersionControl\GitlabIssueBundle\Form\DataTransformer\IdToGitlabProjectTransformer; +use Symfony\Component\Form\Extension\Core\Type\ChoiceType; class GitlabProjectType extends AbstractType { @@ -41,7 +42,7 @@ public function configureOptions(OptionsResolver $resolver) public function getParent() { - return 'choice'; + return ChoiceType::class; } public function getBlockPrefix() diff --git a/src/VersionControl/GitlabIssueBundle/Resources/config/services.yml b/src/VersionControl/GitlabIssueBundle/Resources/config/services.yml index 195f58e..688292e 100644 --- a/src/VersionControl/GitlabIssueBundle/Resources/config/services.yml +++ b/src/VersionControl/GitlabIssueBundle/Resources/config/services.yml @@ -12,14 +12,14 @@ services: version_control.issue_form_type.gitlab: class: VersionControl\GitlabIssueBundle\Form\IssueType arguments: - - @version_control.issue_repository_manager + - '@version_control.issue_repository_manager' tags: - {name: 'form.type'} version_control.issue_form_edit_type.gitlab: class: VersionControl\GitlabIssueBundle\Form\IssueEditType arguments: - - @version_control.issue_repository_manager + - '@version_control.issue_repository_manager' tags: - {name: 'form.type'} @@ -41,6 +41,5 @@ services: version_control.form.field.gitlab_project_choice: class: VersionControl\GitlabIssueBundle\Form\Field\GitlabProjectType - #arguments: ["@doctrine.orm.entity_manager"] tags: - - { name: form.type, alias: gitlab_project_choice } + - { name: form.type } From cda0c64aa3fa96d863a6aa2ca905049aa0742d6e Mon Sep 17 00:00:00 2001 From: Paul Schweppe Date: Mon, 10 Oct 2016 08:48:49 +0100 Subject: [PATCH 05/60] Remove hwi/oauth-bundle --- app/AppKernel.php | 1 - composer.json | 2 +- composer.lock | 123 ++-------------------------------------------- 3 files changed, 5 insertions(+), 121 deletions(-) diff --git a/app/AppKernel.php b/app/AppKernel.php index e9c70d1..11ea9d9 100755 --- a/app/AppKernel.php +++ b/app/AppKernel.php @@ -21,7 +21,6 @@ public function registerBundles() new Knp\Bundle\MarkdownBundle\KnpMarkdownBundle(), new Knp\Bundle\PaginatorBundle\KnpPaginatorBundle(), new Craue\TwigExtensionsBundle\CraueTwigExtensionsBundle(), - //new HWI\Bundle\OAuthBundle\HWIOAuthBundle(), new VersionControl\GithubIssueBundle\VersionControlGithubIssueBundle(), new VersionControl\GitlabIssueBundle\VersionControlGitlabIssueBundle(), new VersionControl\GitCommandBundle\VersionControlGitCommandBundle(), diff --git a/composer.json b/composer.json index 9840106..4544b55 100755 --- a/composer.json +++ b/composer.json @@ -33,7 +33,6 @@ "knplabs/knp-markdown-bundle": "~1.3", "knplabs/knp-paginator-bundle": "^2.5", "craue/twigextensions-bundle": "~2.0", - "hwi/oauth-bundle": "^0.3.9", "knplabs/github-api": "^1.5", "m4tthumphrey/php-gitlab-api": "7.13.*", "doctrine/doctrine-cache-bundle": "^1.3" @@ -68,6 +67,7 @@ "extra": { "symfony-app-dir": "app", "symfony-web-dir": "web", + "symfony-assets-install": "symlink", "incenteev-parameters": { "file": "app/config/parameters.yml" }, diff --git a/composer.lock b/composer.lock index e855cc5..d55717e 100755 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "be87404f3f48a0e5b25876856de33f6c", - "content-hash": "4c17500227838f6b31b1d96c5b12b444", + "hash": "85ff4053328b1a001fd99a9c58c8eb5e", + "content-hash": "28756505a9fbfdaa3ef5b9a72965680e", "packages": [ { "name": "craue/twigextensions-bundle", @@ -841,7 +841,7 @@ }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/FriendsOfSymfony/FOSUserBundle/zipball/d1fccc6335b74beca94525551cacc06b256ed261", + "url": "https://api.github.com/repos/FriendsOfSymfony/FOSUserBundle/zipball/a39d000577d735444bee97de9f5ee382e3f85fa1", "reference": "a39d000577d735444bee97de9f5ee382e3f85fa1", "shasum": "" }, @@ -993,124 +993,9 @@ "rest", "web service" ], + "abandoned": "guzzlehttp/guzzle", "time": "2015-03-18 18:23:50" }, - { - "name": "hwi/oauth-bundle", - "version": "0.3.9", - "target-dir": "HWI/Bundle/OAuthBundle", - "source": { - "type": "git", - "url": "https://github.com/hwi/HWIOAuthBundle.git", - "reference": "ff5d2e3a5af9f665cebd375777ffb8ae437d9262" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/hwi/HWIOAuthBundle/zipball/ff5d2e3a5af9f665cebd375777ffb8ae437d9262", - "reference": "ff5d2e3a5af9f665cebd375777ffb8ae437d9262", - "shasum": "" - }, - "require": { - "kriswallsmith/buzz": "~0.7", - "php": ">=5.3.3", - "symfony/framework-bundle": "~2.1", - "symfony/options-resolver": "~2.1", - "symfony/security-bundle": "~2.1" - }, - "conflict": { - "twig/twig": "<1.12" - }, - "require-dev": { - "doctrine/orm": "~2.2", - "symfony/property-access": "~2.3", - "symfony/twig-bundle": "~2.1", - "symfony/validator": "~2.1" - }, - "suggest": { - "doctrine/doctrine-bundle": "to use Doctrine user provider", - "friendsofsymfony/user-bundle": "to connect FOSUB with this bundle", - "symfony/property-access": "to use FOSUB integration with this bundle", - "symfony/twig-bundle": "to use the Twig hwi_oauth_* functions" - }, - "type": "symfony-bundle", - "extra": { - "branch-alias": { - "dev-master": "0.3-dev" - } - }, - "autoload": { - "psr-0": { - "HWI\\Bundle\\OAuthBundle": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Contributors", - "homepage": "https://github.com/hwi/HWIOAuthBundle/contributors" - }, - { - "name": "Joseph Bielawski", - "email": "stloyd@gmail.com" - }, - { - "name": "Alexander", - "email": "iam.asm89@gmail.com" - }, - { - "name": "Geoffrey Bachelet", - "email": "geoffrey.bachelet@gmail.com" - } - ], - "description": "Support for authenticating users using both OAuth1.0a and OAuth2 in Symfony2.", - "homepage": "http://github.com/hwi/HWIOAuthBundle", - "keywords": [ - "37signals", - "Authentication", - "amazon", - "bitbucket", - "bitly", - "box", - "dailymotion", - "deviantart", - "disqus", - "dropbox", - "eventbrite", - "facebook", - "firewall", - "flickr", - "foursquare", - "github", - "google", - "instagram", - "jira", - "linkedin", - "mail.ru", - "oauth", - "oauth1", - "oauth2", - "odnoklassniki", - "qq", - "salesforce", - "security", - "sensio connect", - "sina weibo", - "stack exchange", - "stereomood", - "trello", - "twitch", - "twitter", - "vkontakte", - "windows live", - "wordpress", - "yahoo", - "yandex" - ], - "time": "2015-08-28 09:57:17" - }, { "name": "incenteev/composer-parameter-handler", "version": "v2.1.2", From 0fdf005acba5130765c4881b49424f5eb4fdf48e Mon Sep 17 00:00:00 2001 From: Paul Schweppe Date: Mon, 10 Oct 2016 09:37:30 +0100 Subject: [PATCH 06/60] Fixed up deprecation issues --- composer.lock | 496 +++++++++--------- .../Embbed/ProjectEnvironmentEmbbedType.php | 4 +- .../Form/Field/EntityHiddenType.php | 4 +- .../Form/RegistrationType.php | 8 +- .../views/UserManagement/new.html.twig | 5 - .../GithubIssueBundle/Form/IssueEditType.php | 2 +- .../Form/Field/GitlabProjectType.php | 1 - .../GitlabIssueBundle/Form/IssueEditType.php | 5 +- 8 files changed, 250 insertions(+), 275 deletions(-) diff --git a/composer.lock b/composer.lock index d55717e..aae71fa 100755 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "85ff4053328b1a001fd99a9c58c8eb5e", - "content-hash": "28756505a9fbfdaa3ef5b9a72965680e", + "hash": "16353a473b7887fa17026a2e6939f808", + "content-hash": "fbff66f2d35034e404826e53b301caa7", "packages": [ { "name": "craue/twigextensions-bundle", @@ -135,33 +135,33 @@ }, { "name": "doctrine/cache", - "version": "v1.5.4", + "version": "v1.6.0", "source": { "type": "git", "url": "https://github.com/doctrine/cache.git", - "reference": "47cdc76ceb95cc591d9c79a36dc3794975b5d136" + "reference": "f8af318d14bdb0eff0336795b428b547bd39ccb6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/cache/zipball/47cdc76ceb95cc591d9c79a36dc3794975b5d136", - "reference": "47cdc76ceb95cc591d9c79a36dc3794975b5d136", + "url": "https://api.github.com/repos/doctrine/cache/zipball/f8af318d14bdb0eff0336795b428b547bd39ccb6", + "reference": "f8af318d14bdb0eff0336795b428b547bd39ccb6", "shasum": "" }, "require": { - "php": ">=5.3.2" + "php": "~5.5|~7.0" }, "conflict": { "doctrine/common": ">2.2,<2.4" }, "require-dev": { - "phpunit/phpunit": ">=3.7", + "phpunit/phpunit": "~4.8|~5.0", "predis/predis": "~1.0", "satooshi/php-coveralls": "~0.6" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.5.x-dev" + "dev-master": "1.6.x-dev" } }, "autoload": { @@ -201,7 +201,7 @@ "cache", "caching" ], - "time": "2015-12-19 05:03:47" + "time": "2015-12-31 16:37:02" }, { "name": "doctrine/collections", @@ -271,16 +271,16 @@ }, { "name": "doctrine/common", - "version": "v2.5.3", + "version": "v2.6.1", "source": { "type": "git", "url": "https://github.com/doctrine/common.git", - "reference": "10f1f19651343f87573129ca970aef1a47a6f29e" + "reference": "a579557bc689580c19fee4e27487a67fe60defc0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/common/zipball/10f1f19651343f87573129ca970aef1a47a6f29e", - "reference": "10f1f19651343f87573129ca970aef1a47a6f29e", + "url": "https://api.github.com/repos/doctrine/common/zipball/a579557bc689580c19fee4e27487a67fe60defc0", + "reference": "a579557bc689580c19fee4e27487a67fe60defc0", "shasum": "" }, "require": { @@ -289,20 +289,20 @@ "doctrine/collections": "1.*", "doctrine/inflector": "1.*", "doctrine/lexer": "1.*", - "php": ">=5.3.2" + "php": "~5.5|~7.0" }, "require-dev": { - "phpunit/phpunit": "~3.7" + "phpunit/phpunit": "~4.8|~5.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.5.x-dev" + "dev-master": "2.7.x-dev" } }, "autoload": { - "psr-0": { - "Doctrine\\Common\\": "lib/" + "psr-4": { + "Doctrine\\Common\\": "lib/Doctrine/Common" } }, "notification-url": "https://packagist.org/downloads/", @@ -340,20 +340,20 @@ "persistence", "spl" ], - "time": "2015-12-25 13:10:16" + "time": "2015-12-25 13:18:31" }, { "name": "doctrine/dbal", - "version": "v2.5.4", + "version": "v2.5.5", "source": { "type": "git", "url": "https://github.com/doctrine/dbal.git", - "reference": "abbdfd1cff43a7b99d027af3be709bc8fc7d4769" + "reference": "9f8c05cd5225a320d56d4bfdb4772f10d045a0c9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/dbal/zipball/abbdfd1cff43a7b99d027af3be709bc8fc7d4769", - "reference": "abbdfd1cff43a7b99d027af3be709bc8fc7d4769", + "url": "https://api.github.com/repos/doctrine/dbal/zipball/9f8c05cd5225a320d56d4bfdb4772f10d045a0c9", + "reference": "9f8c05cd5225a320d56d4bfdb4772f10d045a0c9", "shasum": "" }, "require": { @@ -362,7 +362,7 @@ }, "require-dev": { "phpunit/phpunit": "4.*", - "symfony/console": "2.*" + "symfony/console": "2.*||^3.0" }, "suggest": { "symfony/console": "For helpful console commands such as SQL execution and import of files." @@ -411,20 +411,20 @@ "persistence", "queryobject" ], - "time": "2016-01-05 22:11:12" + "time": "2016-09-09 19:13:33" }, { "name": "doctrine/doctrine-bundle", - "version": "1.6.2", + "version": "1.6.4", "source": { "type": "git", "url": "https://github.com/doctrine/DoctrineBundle.git", - "reference": "e9c2ccf573b59b7cea566390f34254fed3c20ed9" + "reference": "dd40b0a7fb16658cda9def9786992b8df8a49be7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/DoctrineBundle/zipball/e9c2ccf573b59b7cea566390f34254fed3c20ed9", - "reference": "e9c2ccf573b59b7cea566390f34254fed3c20ed9", + "url": "https://api.github.com/repos/doctrine/DoctrineBundle/zipball/dd40b0a7fb16658cda9def9786992b8df8a49be7", + "reference": "dd40b0a7fb16658cda9def9786992b8df8a49be7", "shasum": "" }, "require": { @@ -433,6 +433,7 @@ "jdorn/sql-formatter": "~1.1", "php": ">=5.3.2", "symfony/console": "~2.3|~3.0", + "symfony/dependency-injection": "~2.3|~3.0", "symfony/doctrine-bridge": "~2.2|~3.0", "symfony/framework-bundle": "~2.3|~3.0" }, @@ -441,13 +442,14 @@ "phpunit/phpunit": "~4", "satooshi/php-coveralls": "~0.6.1", "symfony/phpunit-bridge": "~2.7|~3.0", + "symfony/property-info": "~2.8|~3.0", "symfony/validator": "~2.2|~3.0", "symfony/yaml": "~2.2|~3.0", "twig/twig": "~1.10" }, "suggest": { "doctrine/orm": "The Doctrine ORM integration is optional in the bundle.", - "symfony/web-profiler-bundle": "to use the data collector" + "symfony/web-profiler-bundle": "To use the data collector." }, "type": "symfony-bundle", "extra": { @@ -490,7 +492,7 @@ "orm", "persistence" ], - "time": "2016-01-10 17:21:44" + "time": "2016-08-10 15:35:22" }, { "name": "doctrine/doctrine-cache-bundle", @@ -757,16 +759,16 @@ }, { "name": "doctrine/orm", - "version": "v2.5.4", + "version": "v2.5.5", "source": { "type": "git", "url": "https://github.com/doctrine/doctrine2.git", - "reference": "bc4ddbfb0114cb33438cc811c9a740d8aa304aab" + "reference": "73e4be7c7b3ba26f96b781a40b33feba4dfa6d45" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/doctrine2/zipball/bc4ddbfb0114cb33438cc811c9a740d8aa304aab", - "reference": "bc4ddbfb0114cb33438cc811c9a740d8aa304aab", + "url": "https://api.github.com/repos/doctrine/doctrine2/zipball/73e4be7c7b3ba26f96b781a40b33feba4dfa6d45", + "reference": "73e4be7c7b3ba26f96b781a40b33feba4dfa6d45", "shasum": "" }, "require": { @@ -829,7 +831,7 @@ "database", "orm" ], - "time": "2016-01-05 21:34:58" + "time": "2016-09-10 18:51:13" }, { "name": "friendsofsymfony/user-bundle", @@ -837,29 +839,32 @@ "source": { "type": "git", "url": "https://github.com/FriendsOfSymfony/FOSUserBundle.git", - "reference": "a39d000577d735444bee97de9f5ee382e3f85fa1" + "reference": "962a7f3603cce63dae2a84839f030ddb748d890b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/FriendsOfSymfony/FOSUserBundle/zipball/a39d000577d735444bee97de9f5ee382e3f85fa1", - "reference": "a39d000577d735444bee97de9f5ee382e3f85fa1", + "url": "https://api.github.com/repos/FriendsOfSymfony/FOSUserBundle/zipball/962a7f3603cce63dae2a84839f030ddb748d890b", + "reference": "962a7f3603cce63dae2a84839f030ddb748d890b", "shasum": "" }, "require": { - "php": ">=5.3.9", - "symfony/form": "~2.3|~3.0", - "symfony/framework-bundle": "~2.3|~3.0", - "symfony/security-bundle": "~2.3|~3.0", - "symfony/twig-bundle": "~2.3|~3.0" + "php": "^5.3.9 || ^7.0", + "symfony/form": "^2.3 || ^3.0", + "symfony/framework-bundle": "^2.3 || ^3.0", + "symfony/security-bundle": "^2.3 || ^3.0", + "symfony/twig-bundle": "^2.3 || ^3.0" + }, + "conflict": { + "symfony/doctrine-bridge": "<2.3" }, "require-dev": { - "doctrine/doctrine-bundle": "~1.3", - "swiftmailer/swiftmailer": "~4.3|~5", - "symfony/console": "~2.3|~3.0", - "symfony/phpunit-bridge": "~2.7|~3.0", - "symfony/validator": "~2.3|~3.0", - "symfony/yaml": "~2.3|~3.0", - "willdurand/propel-typehintable-behavior": "~1.0" + "doctrine/doctrine-bundle": "^1.3", + "swiftmailer/swiftmailer": "^4.3 || ^5.0", + "symfony/console": "^2.3 || ^3.0", + "symfony/phpunit-bridge": "^2.7 || ^3.0", + "symfony/validator": "^2.3 || ^3.0", + "symfony/yaml": "^2.3 || ^3.0", + "willdurand/propel-typehintable-behavior": "^1.0" }, "suggest": { "willdurand/propel-typehintable-behavior": "Needed when using the propel implementation" @@ -873,7 +878,10 @@ "autoload": { "psr-4": { "FOS\\UserBundle\\": "" - } + }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -898,7 +906,7 @@ "keywords": [ "User management" ], - "time": "2016-03-01 11:42:24" + "time": "2016-10-07 07:55:07" }, { "name": "guzzle/guzzle", @@ -1141,16 +1149,16 @@ }, { "name": "knplabs/github-api", - "version": "1.6.0", + "version": "1.7.1", "source": { "type": "git", "url": "https://github.com/KnpLabs/php-github-api.git", - "reference": "5720f828ea241eded6c6263249fa00b0a37650f4" + "reference": "98d0bcd2c4c96a40ded9081f8f6289907f73823c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/KnpLabs/php-github-api/zipball/5720f828ea241eded6c6263249fa00b0a37650f4", - "reference": "5720f828ea241eded6c6263249fa00b0a37650f4", + "url": "https://api.github.com/repos/KnpLabs/php-github-api/zipball/98d0bcd2c4c96a40ded9081f8f6289907f73823c", + "reference": "98d0bcd2c4c96a40ded9081f8f6289907f73823c", "shasum": "" }, "require": { @@ -1168,7 +1176,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.5.x-dev" + "dev-master": "1.8.x-dev" } }, "autoload": { @@ -1199,20 +1207,20 @@ "gist", "github" ], - "time": "2016-02-24 05:52:33" + "time": "2016-07-26 08:49:38" }, { "name": "knplabs/knp-components", - "version": "1.3.2", + "version": "1.3.3", "source": { "type": "git", "url": "https://github.com/KnpLabs/knp-components.git", - "reference": "4503275e4f1a0e9667aa65b0ebed842ef2d8d8ba" + "reference": "bc49e739d1cce94d783b1e23bc5b263b38dc47da" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/KnpLabs/knp-components/zipball/4503275e4f1a0e9667aa65b0ebed842ef2d8d8ba", - "reference": "4503275e4f1a0e9667aa65b0ebed842ef2d8d8ba", + "url": "https://api.github.com/repos/KnpLabs/knp-components/zipball/bc49e739d1cce94d783b1e23bc5b263b38dc47da", + "reference": "bc49e739d1cce94d783b1e23bc5b263b38dc47da", "shasum": "" }, "require": { @@ -1221,6 +1229,8 @@ "require-dev": { "doctrine/mongodb-odm": "~1.0@beta", "doctrine/orm": "~2.4", + "doctrine/phpcr-odm": "~1.2", + "jackalope/jackalope-doctrine-dbal": "~1.2", "phpunit/phpunit": "~4.2", "ruflin/elastica": "~1.0", "symfony/event-dispatcher": "~2.5" @@ -1229,6 +1239,7 @@ "doctrine/common": "to allow usage pagination with Doctrine ArrayCollection", "doctrine/mongodb-odm": "to allow usage pagination with Doctrine ODM MongoDB", "doctrine/orm": "to allow usage pagination with Doctrine ORM", + "doctrine/phpcr-odm": "to allow usage pagination with Doctrine ODM PHPCR", "propel/propel1": "to allow usage pagination with Propel ORM", "ruflin/Elastica": "to allow usage pagination with ElasticSearch Client", "solarium/solarium": "to allow usage pagination with Solarium Client" @@ -1267,25 +1278,26 @@ "pager", "paginator" ], - "time": "2015-09-01 10:54:53" + "time": "2016-04-21 06:26:20" }, { "name": "knplabs/knp-markdown-bundle", - "version": "1.4.2", + "version": "1.5.1", "source": { "type": "git", "url": "https://github.com/KnpLabs/KnpMarkdownBundle.git", - "reference": "27d6c8c866a5fef70df3f219e6c2afab25e145ce" + "reference": "3581dabfc5e6627261abb0b6513b73b8e95f2c92" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/KnpLabs/KnpMarkdownBundle/zipball/27d6c8c866a5fef70df3f219e6c2afab25e145ce", - "reference": "27d6c8c866a5fef70df3f219e6c2afab25e145ce", + "url": "https://api.github.com/repos/KnpLabs/KnpMarkdownBundle/zipball/3581dabfc5e6627261abb0b6513b73b8e95f2c92", + "reference": "3581dabfc5e6627261abb0b6513b73b8e95f2c92", "shasum": "" }, "require": { "michelf/php-markdown": "~1.4", "php": ">=5.3.9", + "symfony/dependency-injection": "~2.3|~3.0", "symfony/framework-bundle": "~2.3|~3.0" }, "require-dev": { @@ -1328,20 +1340,20 @@ "knplabs", "markdown" ], - "time": "2015-12-15 20:41:45" + "time": "2016-05-04 16:08:55" }, { "name": "knplabs/knp-paginator-bundle", - "version": "2.5.1", + "version": "2.5.3", "source": { "type": "git", "url": "https://github.com/KnpLabs/KnpPaginatorBundle.git", - "reference": "5147740faff4d32e6f42acf64475314c35320fa4" + "reference": "c988761005504007c6c87d6a557641281194a0e5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/KnpLabs/KnpPaginatorBundle/zipball/5147740faff4d32e6f42acf64475314c35320fa4", - "reference": "5147740faff4d32e6f42acf64475314c35320fa4", + "url": "https://api.github.com/repos/KnpLabs/KnpPaginatorBundle/zipball/c988761005504007c6c87d6a557641281194a0e5", + "reference": "c988761005504007c6c87d6a557641281194a0e5", "shasum": "" }, "require": { @@ -1356,7 +1368,7 @@ "type": "symfony-bundle", "extra": { "branch-alias": { - "dev-master": "2.4.x-dev" + "dev-master": "2.5.x-dev" } }, "autoload": { @@ -1389,7 +1401,7 @@ "pagination", "paginator" ], - "time": "2015-11-23 17:51:40" + "time": "2016-04-20 11:40:30" }, { "name": "kriswallsmith/assetic", @@ -1565,16 +1577,16 @@ }, { "name": "m4tthumphrey/php-gitlab-api", - "version": "7.13.0", + "version": "7.13.1", "source": { "type": "git", "url": "https://github.com/m4tthumphrey/php-gitlab-api.git", - "reference": "65dc67929188f26e2059e99deb56e9c5608232b5" + "reference": "aefeb9409bd517da7da7762087fc67ac6416d9a8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/m4tthumphrey/php-gitlab-api/zipball/65dc67929188f26e2059e99deb56e9c5608232b5", - "reference": "65dc67929188f26e2059e99deb56e9c5608232b5", + "url": "https://api.github.com/repos/m4tthumphrey/php-gitlab-api/zipball/aefeb9409bd517da7da7762087fc67ac6416d9a8", + "reference": "aefeb9409bd517da7da7762087fc67ac6416d9a8", "shasum": "" }, "require": { @@ -1616,7 +1628,7 @@ "api", "gitlab" ], - "time": "2015-07-28 11:27:19" + "time": "2016-06-20 12:44:22" }, { "name": "michelf/php-markdown", @@ -1671,16 +1683,16 @@ }, { "name": "monolog/monolog", - "version": "1.18.1", + "version": "1.21.0", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "a5f2734e8c16f3aa21b3da09715d10e15b4d2d45" + "reference": "f42fbdfd53e306bda545845e4dbfd3e72edb4952" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/a5f2734e8c16f3aa21b3da09715d10e15b4d2d45", - "reference": "a5f2734e8c16f3aa21b3da09715d10e15b4d2d45", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/f42fbdfd53e306bda545845e4dbfd3e72edb4952", + "reference": "f42fbdfd53e306bda545845e4dbfd3e72edb4952", "shasum": "" }, "require": { @@ -1695,13 +1707,13 @@ "doctrine/couchdb": "~1.0@dev", "graylog2/gelf-php": "~1.0", "jakub-onderka/php-parallel-lint": "0.9", + "php-amqplib/php-amqplib": "~2.4", "php-console/php-console": "^3.1.3", "phpunit/phpunit": "~4.5", "phpunit/phpunit-mock-objects": "2.3.0", - "raven/raven": "^0.13", "ruflin/elastica": ">=0.90 <3.0", - "swiftmailer/swiftmailer": "~5.3", - "videlalvaro/php-amqplib": "~2.4" + "sentry/sentry": "^0.13", + "swiftmailer/swiftmailer": "~5.3" }, "suggest": { "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB", @@ -1710,11 +1722,11 @@ "ext-mongo": "Allow sending log messages to a MongoDB server", "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", "mongodb/mongodb": "Allow sending log messages to a MongoDB server via PHP Driver", + "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib", "php-console/php-console": "Allow sending log messages to Google Chrome", - "raven/raven": "Allow sending log messages to a Sentry server", "rollbar/rollbar": "Allow sending log messages to Rollbar", "ruflin/elastica": "Allow sending log messages to an Elastic Search server", - "videlalvaro/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib" + "sentry/sentry": "Allow sending log messages to a Sentry server" }, "type": "library", "extra": { @@ -1745,20 +1757,20 @@ "logging", "psr-3" ], - "time": "2016-03-13 16:08:35" + "time": "2016-07-29 03:23:52" }, { "name": "paragonie/random_compat", - "version": "v1.2.1", + "version": "v2.0.2", "source": { "type": "git", "url": "https://github.com/paragonie/random_compat.git", - "reference": "f078eba3bcf140fd69b5fcc3ea5ac809abf729dc" + "reference": "088c04e2f261c33bed6ca5245491cfca69195ccf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/paragonie/random_compat/zipball/f078eba3bcf140fd69b5fcc3ea5ac809abf729dc", - "reference": "f078eba3bcf140fd69b5fcc3ea5ac809abf729dc", + "url": "https://api.github.com/repos/paragonie/random_compat/zipball/088c04e2f261c33bed6ca5245491cfca69195ccf", + "reference": "088c04e2f261c33bed6ca5245491cfca69195ccf", "shasum": "" }, "require": { @@ -1793,20 +1805,20 @@ "pseudorandom", "random" ], - "time": "2016-02-29 17:25:04" + "time": "2016-04-03 06:00:07" }, { "name": "phpseclib/phpseclib", - "version": "2.0.1", + "version": "2.0.4", "source": { "type": "git", "url": "https://github.com/phpseclib/phpseclib.git", - "reference": "ba6fb78f727cd09f2a649113b95468019e490585" + "reference": "ab8028c93c03cc8d9c824efa75dc94f1db2369bf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/ba6fb78f727cd09f2a649113b95468019e490585", - "reference": "ba6fb78f727cd09f2a649113b95468019e490585", + "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/ab8028c93c03cc8d9c824efa75dc94f1db2369bf", + "reference": "ab8028c93c03cc8d9c824efa75dc94f1db2369bf", "shasum": "" }, "require": { @@ -1826,6 +1838,9 @@ }, "type": "library", "autoload": { + "files": [ + "phpseclib/bootstrap.php" + ], "psr-4": { "phpseclib\\": "phpseclib/" } @@ -1882,26 +1897,34 @@ "x.509", "x509" ], - "time": "2016-01-18 17:07:21" + "time": "2016-10-04 00:57:04" }, { "name": "psr/log", - "version": "1.0.0", + "version": "1.0.1", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "fe0936ee26643249e916849d48e3a51d5f5e278b" + "reference": "5277094ed527a1c4477177d102fe4c53551953e0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/fe0936ee26643249e916849d48e3a51d5f5e278b", - "reference": "fe0936ee26643249e916849d48e3a51d5f5e278b", + "url": "https://api.github.com/repos/php-fig/log/zipball/5277094ed527a1c4477177d102fe4c53551953e0", + "reference": "5277094ed527a1c4477177d102fe4c53551953e0", "shasum": "" }, + "require": { + "php": ">=5.3.0" + }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, "autoload": { - "psr-0": { - "Psr\\Log\\": "" + "psr-4": { + "Psr\\Log\\": "Psr/Log/" } }, "notification-url": "https://packagist.org/downloads/", @@ -1915,12 +1938,13 @@ } ], "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", "keywords": [ "log", "psr", "psr-3" ], - "time": "2012-12-21 11:40:51" + "time": "2016-09-19 16:02:08" }, { "name": "salavert/time-ago-in-words", @@ -1980,17 +2004,17 @@ }, { "name": "sensio/distribution-bundle", - "version": "v3.0.35", + "version": "v3.0.36", "target-dir": "Sensio/Bundle/DistributionBundle", "source": { "type": "git", "url": "https://github.com/sensiolabs/SensioDistributionBundle.git", - "reference": "abc5b0ce28f72f838922aa0e0a107ba270dbabb5" + "reference": "964a56e855acac38d4a81920b3a86543f7e8492f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sensiolabs/SensioDistributionBundle/zipball/abc5b0ce28f72f838922aa0e0a107ba270dbabb5", - "reference": "abc5b0ce28f72f838922aa0e0a107ba270dbabb5", + "url": "https://api.github.com/repos/sensiolabs/SensioDistributionBundle/zipball/964a56e855acac38d4a81920b3a86543f7e8492f", + "reference": "964a56e855acac38d4a81920b3a86543f7e8492f", "shasum": "" }, "require": { @@ -2036,20 +2060,20 @@ "configuration", "distribution" ], - "time": "2015-12-08 17:53:19" + "time": "2016-04-25 20:46:43" }, { "name": "sensio/framework-extra-bundle", - "version": "v3.0.14", + "version": "v3.0.16", "source": { "type": "git", "url": "https://github.com/sensiolabs/SensioFrameworkExtraBundle.git", - "reference": "cccf975c565ccd835bddc30a8fea5cdfe3357bf1" + "reference": "507a15f56fa7699f6cc8c2c7de4080b19ce22546" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sensiolabs/SensioFrameworkExtraBundle/zipball/cccf975c565ccd835bddc30a8fea5cdfe3357bf1", - "reference": "cccf975c565ccd835bddc30a8fea5cdfe3357bf1", + "url": "https://api.github.com/repos/sensiolabs/SensioFrameworkExtraBundle/zipball/507a15f56fa7699f6cc8c2c7de4080b19ce22546", + "reference": "507a15f56fa7699f6cc8c2c7de4080b19ce22546", "shasum": "" }, "require": { @@ -2098,7 +2122,7 @@ "annotations", "controllers" ], - "time": "2016-03-01 10:50:07" + "time": "2016-03-25 17:08:27" }, { "name": "sensiolabs/security-checker", @@ -2146,23 +2170,23 @@ }, { "name": "swiftmailer/swiftmailer", - "version": "v5.4.1", + "version": "v5.4.3", "source": { "type": "git", "url": "https://github.com/swiftmailer/swiftmailer.git", - "reference": "0697e6aa65c83edf97bb0f23d8763f94e3f11421" + "reference": "4cc92842069c2bbc1f28daaaf1d2576ec4dfe153" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/0697e6aa65c83edf97bb0f23d8763f94e3f11421", - "reference": "0697e6aa65c83edf97bb0f23d8763f94e3f11421", + "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/4cc92842069c2bbc1f28daaaf1d2576ec4dfe153", + "reference": "4cc92842069c2bbc1f28daaaf1d2576ec4dfe153", "shasum": "" }, "require": { "php": ">=5.3.3" }, "require-dev": { - "mockery/mockery": "~0.9.1,<0.9.4" + "mockery/mockery": "~0.9.1" }, "type": "library", "extra": { @@ -2195,7 +2219,7 @@ "mail", "mailer" ], - "time": "2015-06-06 14:19:39" + "time": "2016-07-08 11:51:25" }, { "name": "symfony/assetic-bundle", @@ -2269,20 +2293,20 @@ }, { "name": "symfony/monolog-bundle", - "version": "v2.10.0", + "version": "2.11.1", "source": { "type": "git", "url": "https://github.com/symfony/monolog-bundle.git", - "reference": "82fd8f36e2cccbe94faf237403c48052d4d4b77e" + "reference": "e7caf4936c7be82bc6d68df87f1d23a0d5bf6e00" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/monolog-bundle/zipball/82fd8f36e2cccbe94faf237403c48052d4d4b77e", - "reference": "82fd8f36e2cccbe94faf237403c48052d4d4b77e", + "url": "https://api.github.com/repos/symfony/monolog-bundle/zipball/e7caf4936c7be82bc6d68df87f1d23a0d5bf6e00", + "reference": "e7caf4936c7be82bc6d68df87f1d23a0d5bf6e00", "shasum": "" }, "require": { - "monolog/monolog": "~1.12", + "monolog/monolog": "~1.18", "php": ">=5.3.2", "symfony/config": "~2.3|~3.0", "symfony/dependency-injection": "~2.3|~3.0", @@ -2297,7 +2321,7 @@ "type": "symfony-bundle", "extra": { "branch-alias": { - "dev-master": "2.9.x-dev" + "dev-master": "2.x-dev" } }, "autoload": { @@ -2325,20 +2349,20 @@ "log", "logging" ], - "time": "2016-03-13 15:55:56" + "time": "2016-04-13 16:21:01" }, { "name": "symfony/polyfill-apcu", - "version": "v1.1.0", + "version": "v1.2.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-apcu.git", - "reference": "d1911e6caeb4b6a4c8e2d5c46b978a66b3745e4c" + "reference": "6d58bceaeea2c2d3eb62503839b18646e161cd6b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-apcu/zipball/d1911e6caeb4b6a4c8e2d5c46b978a66b3745e4c", - "reference": "d1911e6caeb4b6a4c8e2d5c46b978a66b3745e4c", + "url": "https://api.github.com/repos/symfony/polyfill-apcu/zipball/6d58bceaeea2c2d3eb62503839b18646e161cd6b", + "reference": "6d58bceaeea2c2d3eb62503839b18646e161cd6b", "shasum": "" }, "require": { @@ -2347,15 +2371,12 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1-dev" + "dev-master": "1.2-dev" } }, "autoload": { "files": [ "bootstrap.php" - ], - "classmap": [ - "Resources/stubs" ] }, "notification-url": "https://packagist.org/downloads/", @@ -2381,30 +2402,33 @@ "portable", "shim" ], - "time": "2016-01-20 09:13:37" + "time": "2016-05-18 14:26:46" }, { "name": "symfony/polyfill-intl-icu", - "version": "v1.1.0", + "version": "v1.2.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-icu.git", - "reference": "66b0bb4abda229bc073eff6bbc8f2685bdaac165" + "reference": "0f8dc2c45f69f8672379e9210bca4a115cd5146f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-icu/zipball/66b0bb4abda229bc073eff6bbc8f2685bdaac165", - "reference": "66b0bb4abda229bc073eff6bbc8f2685bdaac165", + "url": "https://api.github.com/repos/symfony/polyfill-intl-icu/zipball/0f8dc2c45f69f8672379e9210bca4a115cd5146f", + "reference": "0f8dc2c45f69f8672379e9210bca4a115cd5146f", "shasum": "" }, "require": { "php": ">=5.3.3", "symfony/intl": "~2.3|~3.0" }, + "suggest": { + "ext-intl": "For best performance" + }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1-dev" + "dev-master": "1.2-dev" } }, "autoload": { @@ -2436,20 +2460,20 @@ "portable", "shim" ], - "time": "2016-01-20 09:13:37" + "time": "2016-05-18 14:26:46" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.1.0", + "version": "v1.2.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "1289d16209491b584839022f29257ad859b8532d" + "reference": "dff51f72b0706335131b00a7f49606168c582594" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/1289d16209491b584839022f29257ad859b8532d", - "reference": "1289d16209491b584839022f29257ad859b8532d", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/dff51f72b0706335131b00a7f49606168c582594", + "reference": "dff51f72b0706335131b00a7f49606168c582594", "shasum": "" }, "require": { @@ -2461,7 +2485,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1-dev" + "dev-master": "1.2-dev" } }, "autoload": { @@ -2495,20 +2519,20 @@ "portable", "shim" ], - "time": "2016-01-20 09:13:37" + "time": "2016-05-18 14:26:46" }, { "name": "symfony/polyfill-php54", - "version": "v1.1.0", + "version": "v1.2.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php54.git", - "reference": "74663d5a2ff3c530c1bc0571500e0feec9094054" + "reference": "34d761992f6f2cc6092cc0e5e93f38b53ba5e4f1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php54/zipball/74663d5a2ff3c530c1bc0571500e0feec9094054", - "reference": "74663d5a2ff3c530c1bc0571500e0feec9094054", + "url": "https://api.github.com/repos/symfony/polyfill-php54/zipball/34d761992f6f2cc6092cc0e5e93f38b53ba5e4f1", + "reference": "34d761992f6f2cc6092cc0e5e93f38b53ba5e4f1", "shasum": "" }, "require": { @@ -2517,7 +2541,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1-dev" + "dev-master": "1.2-dev" } }, "autoload": { @@ -2553,20 +2577,20 @@ "portable", "shim" ], - "time": "2016-01-20 09:13:37" + "time": "2016-05-18 14:26:46" }, { "name": "symfony/polyfill-php55", - "version": "v1.1.0", + "version": "v1.2.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php55.git", - "reference": "b4f3f07d91702f8f926339fc4fcf81671d8c27e6" + "reference": "bf2ff9ad6be1a4772cb873e4eea94d70daa95c6d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php55/zipball/b4f3f07d91702f8f926339fc4fcf81671d8c27e6", - "reference": "b4f3f07d91702f8f926339fc4fcf81671d8c27e6", + "url": "https://api.github.com/repos/symfony/polyfill-php55/zipball/bf2ff9ad6be1a4772cb873e4eea94d70daa95c6d", + "reference": "bf2ff9ad6be1a4772cb873e4eea94d70daa95c6d", "shasum": "" }, "require": { @@ -2576,7 +2600,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1-dev" + "dev-master": "1.2-dev" } }, "autoload": { @@ -2609,20 +2633,20 @@ "portable", "shim" ], - "time": "2016-01-20 09:13:37" + "time": "2016-05-18 14:26:46" }, { "name": "symfony/polyfill-php56", - "version": "v1.1.0", + "version": "v1.2.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php56.git", - "reference": "4d891fff050101a53a4caabb03277284942d1ad9" + "reference": "3edf57a8fbf9a927533344cef65ad7e1cf31030a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php56/zipball/4d891fff050101a53a4caabb03277284942d1ad9", - "reference": "4d891fff050101a53a4caabb03277284942d1ad9", + "url": "https://api.github.com/repos/symfony/polyfill-php56/zipball/3edf57a8fbf9a927533344cef65ad7e1cf31030a", + "reference": "3edf57a8fbf9a927533344cef65ad7e1cf31030a", "shasum": "" }, "require": { @@ -2632,7 +2656,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1-dev" + "dev-master": "1.2-dev" } }, "autoload": { @@ -2665,30 +2689,30 @@ "portable", "shim" ], - "time": "2016-01-20 09:13:37" + "time": "2016-05-18 14:26:46" }, { "name": "symfony/polyfill-php70", - "version": "v1.1.0", + "version": "v1.2.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php70.git", - "reference": "8428ceddbbaf102f2906769a8ef2438220c5cb95" + "reference": "a42f4b6b05ed458910f8af4c4e1121b0101b2d85" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/8428ceddbbaf102f2906769a8ef2438220c5cb95", - "reference": "8428ceddbbaf102f2906769a8ef2438220c5cb95", + "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/a42f4b6b05ed458910f8af4c4e1121b0101b2d85", + "reference": "a42f4b6b05ed458910f8af4c4e1121b0101b2d85", "shasum": "" }, "require": { - "paragonie/random_compat": "~1.0", + "paragonie/random_compat": "~1.0|~2.0", "php": ">=5.3.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1-dev" + "dev-master": "1.2-dev" } }, "autoload": { @@ -2724,20 +2748,20 @@ "portable", "shim" ], - "time": "2016-01-25 08:44:42" + "time": "2016-05-18 14:26:46" }, { "name": "symfony/polyfill-util", - "version": "v1.1.0", + "version": "v1.2.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-util.git", - "reference": "8de62801aa12bc4dfcf85eef5d21981ae7bb3cc4" + "reference": "ef830ce3d218e622b221d6bfad42c751d974bf99" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-util/zipball/8de62801aa12bc4dfcf85eef5d21981ae7bb3cc4", - "reference": "8de62801aa12bc4dfcf85eef5d21981ae7bb3cc4", + "url": "https://api.github.com/repos/symfony/polyfill-util/zipball/ef830ce3d218e622b221d6bfad42c751d974bf99", + "reference": "ef830ce3d218e622b221d6bfad42c751d974bf99", "shasum": "" }, "require": { @@ -2746,7 +2770,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1-dev" + "dev-master": "1.2-dev" } }, "autoload": { @@ -2776,31 +2800,31 @@ "polyfill", "shim" ], - "time": "2016-01-20 09:13:37" + "time": "2016-05-18 14:26:46" }, { "name": "symfony/security-acl", - "version": "v2.8.0", + "version": "v3.0.0", "source": { "type": "git", "url": "https://github.com/symfony/security-acl.git", - "reference": "4a3f7327ad215242c78f6564ad4ea6d2db1b8347" + "reference": "053b49bf4aa333a392c83296855989bcf88ddad1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/security-acl/zipball/4a3f7327ad215242c78f6564ad4ea6d2db1b8347", - "reference": "4a3f7327ad215242c78f6564ad4ea6d2db1b8347", + "url": "https://api.github.com/repos/symfony/security-acl/zipball/053b49bf4aa333a392c83296855989bcf88ddad1", + "reference": "053b49bf4aa333a392c83296855989bcf88ddad1", "shasum": "" }, "require": { - "php": ">=5.3.9", - "symfony/security-core": "~2.4|~3.0.0" + "php": ">=5.5.9", + "symfony/security-core": "~2.8|~3.0" }, "require-dev": { "doctrine/common": "~2.2", "doctrine/dbal": "~2.2", "psr/log": "~1.0", - "symfony/phpunit-bridge": "~2.7|~3.0.0" + "symfony/phpunit-bridge": "~2.8|~3.0" }, "suggest": { "doctrine/dbal": "For using the built-in ACL implementation", @@ -2810,7 +2834,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.8-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -2837,7 +2861,7 @@ ], "description": "Symfony Security Component - ACL (Access Control List)", "homepage": "https://symfony.com", - "time": "2015-12-28 09:39:09" + "time": "2015-12-28 09:39:46" }, { "name": "symfony/swiftmailer-bundle", @@ -2898,16 +2922,16 @@ }, { "name": "symfony/symfony", - "version": "v2.8.3", + "version": "v2.8.12", "source": { "type": "git", "url": "https://github.com/symfony/symfony.git", - "reference": "7a9a5fce7ce6e448e527f635463dda00761e12c2" + "reference": "6a5bc3257b60098c28fc1bbcacd52000dd2801d1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/symfony/zipball/7a9a5fce7ce6e448e527f635463dda00761e12c2", - "reference": "7a9a5fce7ce6e448e527f635463dda00761e12c2", + "url": "https://api.github.com/repos/symfony/symfony/zipball/6a5bc3257b60098c28fc1bbcacd52000dd2801d1", + "reference": "6a5bc3257b60098c28fc1bbcacd52000dd2801d1", "shasum": "" }, "require": { @@ -2922,8 +2946,8 @@ "symfony/polyfill-php56": "~1.0", "symfony/polyfill-php70": "~1.0", "symfony/polyfill-util": "~1.0", - "symfony/security-acl": "~2.7", - "twig/twig": "~1.23|~2.0" + "symfony/security-acl": "~2.7|~3.0.0", + "twig/twig": "~1.26|~2.0" }, "conflict": { "phpdocumentor/reflection": "<1.0.7" @@ -2981,10 +3005,11 @@ "doctrine/dbal": "~2.4", "doctrine/doctrine-bundle": "~1.2", "doctrine/orm": "~2.4,>=2.4.5", - "egulias/email-validator": "~1.2", + "egulias/email-validator": "~1.2,>=1.2.1", "monolog/monolog": "~1.11", "ocramius/proxy-manager": "~0.4|~1.0|~2.0", - "phpdocumentor/reflection": "^1.0.7" + "phpdocumentor/reflection": "^1.0.7", + "symfony/phpunit-bridge": "~3.2" }, "type": "library", "extra": { @@ -3028,20 +3053,20 @@ "keywords": [ "framework" ], - "time": "2016-02-28 21:06:29" + "time": "2016-10-03 18:44:12" }, { "name": "twig/extensions", - "version": "v1.3.0", + "version": "v1.4.0", "source": { "type": "git", "url": "https://github.com/twigphp/Twig-extensions.git", - "reference": "449e3c8a9ffad7c2479c7864557275a32b037499" + "reference": "531eaf4b9ab778b1d7cdd10d40fc6aa74729dfee" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig-extensions/zipball/449e3c8a9ffad7c2479c7864557275a32b037499", - "reference": "449e3c8a9ffad7c2479c7864557275a32b037499", + "url": "https://api.github.com/repos/twigphp/Twig-extensions/zipball/531eaf4b9ab778b1d7cdd10d40fc6aa74729dfee", + "reference": "531eaf4b9ab778b1d7cdd10d40fc6aa74729dfee", "shasum": "" }, "require": { @@ -3056,7 +3081,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.3-dev" + "dev-master": "1.4-dev" } }, "autoload": { @@ -3080,20 +3105,20 @@ "i18n", "text" ], - "time": "2015-08-22 16:38:35" + "time": "2016-09-22 16:50:57" }, { "name": "twig/twig", - "version": "v1.24.0", + "version": "v1.26.1", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "3e5aa30ebfbafd5951fb1b01e338e1800ce7e0e8" + "reference": "a09d8ee17ac1cfea29ed60c83960ad685c6a898d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/3e5aa30ebfbafd5951fb1b01e338e1800ce7e0e8", - "reference": "3e5aa30ebfbafd5951fb1b01e338e1800ce7e0e8", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/a09d8ee17ac1cfea29ed60c83960ad685c6a898d", + "reference": "a09d8ee17ac1cfea29ed60c83960ad685c6a898d", "shasum": "" }, "require": { @@ -3106,7 +3131,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.24-dev" + "dev-master": "1.26-dev" } }, "autoload": { @@ -3141,7 +3166,7 @@ "keywords": [ "templating" ], - "time": "2016-01-25 21:22:18" + "time": "2016-10-05 18:57:41" } ], "packages-dev": [ @@ -3192,51 +3217,6 @@ ], "description": "This bundle generates code for you", "time": "2015-03-17 06:36:52" - }, - { - "name": "vmelnik/doctrine-encrypt-bundle", - "version": "2.0.1", - "target-dir": "VMelnik/DoctrineEncryptBundle", - "source": { - "type": "git", - "url": "https://github.com/vmelnik-ukraine/DoctrineEncryptBundle.git", - "reference": "eedfd91ecdd46fd4c8db040e3704af31832ee39c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/vmelnik-ukraine/DoctrineEncryptBundle/zipball/eedfd91ecdd46fd4c8db040e3704af31832ee39c", - "reference": "eedfd91ecdd46fd4c8db040e3704af31832ee39c", - "shasum": "" - }, - "require": { - "ext-mcrypt": "*", - "php": ">=5.3.2", - "symfony/framework-bundle": ">=2.0" - }, - "type": "library", - "autoload": { - "psr-0": { - "VMelnik\\DoctrineEncryptBundle": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Victor Melnik", - "email": "melnikvictorl@gmail.com" - } - ], - "description": "Symfony 2 bundle which allows to encrypt data in database with some encrypt algorithm", - "keywords": [ - "aes256", - "decrypt", - "doctrine", - "encrypt" - ], - "time": "2013-01-05 22:57:52" } ], "aliases": [], diff --git a/src/VersionControl/GitControlBundle/Form/Embbed/ProjectEnvironmentEmbbedType.php b/src/VersionControl/GitControlBundle/Form/Embbed/ProjectEnvironmentEmbbedType.php index 7e5a4d5..4ef3738 100644 --- a/src/VersionControl/GitControlBundle/Form/Embbed/ProjectEnvironmentEmbbedType.php +++ b/src/VersionControl/GitControlBundle/Form/Embbed/ProjectEnvironmentEmbbedType.php @@ -12,6 +12,8 @@ use Symfony\Component\Form\AbstractType; use Symfony\Component\OptionsResolver\OptionsResolver; +use Symfony\Component\Form\Extension\Core\Type\CollectionType; + /** * Description of ProjectEnvironmentEmbbedType * @@ -25,7 +27,7 @@ public function getBlockPrefix(){ } public function getParent(){ - return 'collection'; + return CollectionType::class; } /** diff --git a/src/VersionControl/GitControlBundle/Form/Field/EntityHiddenType.php b/src/VersionControl/GitControlBundle/Form/Field/EntityHiddenType.php index df20cc4..8d01a33 100644 --- a/src/VersionControl/GitControlBundle/Form/Field/EntityHiddenType.php +++ b/src/VersionControl/GitControlBundle/Form/Field/EntityHiddenType.php @@ -15,6 +15,8 @@ use Symfony\Component\OptionsResolver\OptionsResolver; use Doctrine\Common\Persistence\ObjectManager; +use Symfony\Component\Form\Extension\Core\Type\HiddenType; + class EntityHiddenType extends AbstractType { /** @@ -48,7 +50,7 @@ public function configureOptions(OptionsResolver $resolver) public function getParent() { - return 'hidden'; + return HiddenType::class; } public function getBlockPrefix() diff --git a/src/VersionControl/GitControlBundle/Form/RegistrationType.php b/src/VersionControl/GitControlBundle/Form/RegistrationType.php index 6213e3f..adbdb0a 100644 --- a/src/VersionControl/GitControlBundle/Form/RegistrationType.php +++ b/src/VersionControl/GitControlBundle/Form/RegistrationType.php @@ -12,22 +12,18 @@ use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; +use FOS\UserBundle\Form\Type\RegistrationFormType; class RegistrationType extends AbstractType { public function buildForm(FormBuilderInterface $builder, array $options) { $builder->add('name'); - - /*->add('admin', 'checkbox', array( - 'label' => 'Admin', - 'required' => false, - ));*/ } public function getParent() { - return 'fos_user_registration'; + return RegistrationFormType::class; } public function getBlockPrefix() diff --git a/src/VersionControl/GitControlBundle/Resources/views/UserManagement/new.html.twig b/src/VersionControl/GitControlBundle/Resources/views/UserManagement/new.html.twig index cc7fbc1..7c1553a 100644 --- a/src/VersionControl/GitControlBundle/Resources/views/UserManagement/new.html.twig +++ b/src/VersionControl/GitControlBundle/Resources/views/UserManagement/new.html.twig @@ -60,11 +60,6 @@ {{ form_errors(form.plainPassword.second) }} {{ form_widget(form.plainPassword.second,{ 'attr': { 'class': 'form-control', 'placeholder':'Please repeat password'}}) }} -
- - {{ form_errors(form.admin) }} - {{ form_widget(form.admin) }} -
Cancel diff --git a/src/VersionControl/GithubIssueBundle/Form/IssueEditType.php b/src/VersionControl/GithubIssueBundle/Form/IssueEditType.php index cae9cfd..e27c59a 100755 --- a/src/VersionControl/GithubIssueBundle/Form/IssueEditType.php +++ b/src/VersionControl/GithubIssueBundle/Form/IssueEditType.php @@ -37,7 +37,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) ->add('status',ChoiceType::class,array('label' => 'State' ,'choices' => array('open' => 'Open', 'closed' => 'Close') ,'required' => false - ,'empty_value' => 'Please select a State') + ,'placeholder' => 'Please select a State') ) ->add('issueMilestone',ChoiceType::class,array( 'choices' => $this->getIssueMilestoneChoices(), diff --git a/src/VersionControl/GitlabIssueBundle/Form/Field/GitlabProjectType.php b/src/VersionControl/GitlabIssueBundle/Form/Field/GitlabProjectType.php index 287cec5..fdc14a9 100755 --- a/src/VersionControl/GitlabIssueBundle/Form/Field/GitlabProjectType.php +++ b/src/VersionControl/GitlabIssueBundle/Form/Field/GitlabProjectType.php @@ -33,7 +33,6 @@ public function buildForm(FormBuilderInterface $builder, array $options) public function configureOptions(OptionsResolver $resolver) { $resolver - //->setRequired(array('class')) ->setDefaults(array( 'invalid_message' => 'The entity does not exist.', )) diff --git a/src/VersionControl/GitlabIssueBundle/Form/IssueEditType.php b/src/VersionControl/GitlabIssueBundle/Form/IssueEditType.php index 018028e..3b5c05b 100644 --- a/src/VersionControl/GitlabIssueBundle/Form/IssueEditType.php +++ b/src/VersionControl/GitlabIssueBundle/Form/IssueEditType.php @@ -35,9 +35,10 @@ public function buildForm(FormBuilderInterface $builder, array $options) ->add('title') ->add('description',TextareaType::class) ->add('status',ChoiceType::class,array('label' => 'State' - ,'choices' => array('open' => 'Open', 'closed' => 'Close') + ,'choices' => array('Open' => 'open', 'Closed' => 'close') ,'required' => false - ,'empty_value' => 'Please select a State') + ,'choices_as_values' => true + ,'placeholder' => 'Please select a State') ) ->add('issueMilestone',ChoiceType::class,array( 'choices' => $this->getIssueMilestoneChoices(), From c66ecf5e6963411b4e95ef586bfc109aca10f37c Mon Sep 17 00:00:00 2001 From: Paul Schweppe Date: Wed, 12 Oct 2016 12:16:53 +0100 Subject: [PATCH 07/60] Remove debug code --- .../GitCommandBundle/GitCommands/Command/GitStatusCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/VersionControl/GitCommandBundle/GitCommands/Command/GitStatusCommand.php b/src/VersionControl/GitCommandBundle/GitCommands/Command/GitStatusCommand.php index 57085ff..37d4a07 100644 --- a/src/VersionControl/GitCommandBundle/GitCommands/Command/GitStatusCommand.php +++ b/src/VersionControl/GitCommandBundle/GitCommands/Command/GitStatusCommand.php @@ -33,7 +33,7 @@ class GitStatusCommand extends AbstractGitCommand { public function getStatusHash() { if(!$this->statusHash){ $stausData = $this->getStatus(); - print_r('Status Hash data:'.$stausData); + //print_r('Status Hash data:'.$stausData); $this->statusHash = hash('md5',$stausData); } return $this->statusHash; From 4812c82541c4cb016ac6993fc54c251512411700 Mon Sep 17 00:00:00 2001 From: Paul Schweppe Date: Wed, 12 Oct 2016 12:17:33 +0100 Subject: [PATCH 08/60] Create custom error template for Symfony --- .../views/Exception/error.atom.twig | 1 + .../TwigBundle/views/Exception/error.css.twig | 4 + .../views/Exception/error.html.twig | 31 +++++ .../TwigBundle/views/Exception/error.js.twig | 4 + .../views/Exception/error.json.twig | 1 + .../TwigBundle/views/Exception/error.rdf.twig | 1 + .../TwigBundle/views/Exception/error.txt.twig | 7 + .../TwigBundle/views/Exception/error.xml.twig | 3 + .../views/Exception/exception.atom.twig | 1 + .../views/Exception/exception.css.twig | 3 + .../views/Exception/exception.html.twig | 123 ++++++++++++++++++ .../views/Exception/exception.js.twig | 3 + .../views/Exception/exception.json.twig | 1 + .../views/Exception/exception.rdf.twig | 1 + .../views/Exception/exception.txt.twig | 7 + .../views/Exception/exception.xml.twig | 9 ++ .../views/Exception/exception_full.html.twig | 13 ++ .../TwigBundle/views/Exception/logs.html.twig | 7 + .../views/Exception/trace.html.twig | 22 ++++ .../TwigBundle/views/Exception/trace.txt.twig | 8 ++ .../views/Exception/traces.html.twig | 25 ++++ .../views/Exception/traces.txt.twig | 6 + .../views/Exception/traces.xml.twig | 8 ++ .../views/Exception/traces_text.html.twig | 18 +++ .../TwigBundle/views/error.layout.html.twig | 87 +++++++++++++ .../TwigBundle/views/layout.html.twig | 44 +++++++ .../Resources/public/theme/css/custom.css | 33 +++++ 27 files changed, 471 insertions(+) create mode 100644 app/Resources/TwigBundle/views/Exception/error.atom.twig create mode 100644 app/Resources/TwigBundle/views/Exception/error.css.twig create mode 100644 app/Resources/TwigBundle/views/Exception/error.html.twig create mode 100644 app/Resources/TwigBundle/views/Exception/error.js.twig create mode 100644 app/Resources/TwigBundle/views/Exception/error.json.twig create mode 100644 app/Resources/TwigBundle/views/Exception/error.rdf.twig create mode 100644 app/Resources/TwigBundle/views/Exception/error.txt.twig create mode 100644 app/Resources/TwigBundle/views/Exception/error.xml.twig create mode 100644 app/Resources/TwigBundle/views/Exception/exception.atom.twig create mode 100644 app/Resources/TwigBundle/views/Exception/exception.css.twig create mode 100644 app/Resources/TwigBundle/views/Exception/exception.html.twig create mode 100644 app/Resources/TwigBundle/views/Exception/exception.js.twig create mode 100644 app/Resources/TwigBundle/views/Exception/exception.json.twig create mode 100644 app/Resources/TwigBundle/views/Exception/exception.rdf.twig create mode 100644 app/Resources/TwigBundle/views/Exception/exception.txt.twig create mode 100644 app/Resources/TwigBundle/views/Exception/exception.xml.twig create mode 100644 app/Resources/TwigBundle/views/Exception/exception_full.html.twig create mode 100644 app/Resources/TwigBundle/views/Exception/logs.html.twig create mode 100644 app/Resources/TwigBundle/views/Exception/trace.html.twig create mode 100644 app/Resources/TwigBundle/views/Exception/trace.txt.twig create mode 100644 app/Resources/TwigBundle/views/Exception/traces.html.twig create mode 100644 app/Resources/TwigBundle/views/Exception/traces.txt.twig create mode 100644 app/Resources/TwigBundle/views/Exception/traces.xml.twig create mode 100644 app/Resources/TwigBundle/views/Exception/traces_text.html.twig create mode 100644 app/Resources/TwigBundle/views/error.layout.html.twig create mode 100644 app/Resources/TwigBundle/views/layout.html.twig diff --git a/app/Resources/TwigBundle/views/Exception/error.atom.twig b/app/Resources/TwigBundle/views/Exception/error.atom.twig new file mode 100644 index 0000000..c27cc56 --- /dev/null +++ b/app/Resources/TwigBundle/views/Exception/error.atom.twig @@ -0,0 +1 @@ +{% include '@Twig/Exception/error.xml.twig' %} diff --git a/app/Resources/TwigBundle/views/Exception/error.css.twig b/app/Resources/TwigBundle/views/Exception/error.css.twig new file mode 100644 index 0000000..d8a9369 --- /dev/null +++ b/app/Resources/TwigBundle/views/Exception/error.css.twig @@ -0,0 +1,4 @@ +/* +{{ status_code }} {{ status_text }} + +*/ diff --git a/app/Resources/TwigBundle/views/Exception/error.html.twig b/app/Resources/TwigBundle/views/Exception/error.html.twig new file mode 100644 index 0000000..dc283d1 --- /dev/null +++ b/app/Resources/TwigBundle/views/Exception/error.html.twig @@ -0,0 +1,31 @@ +{% extends '@Twig/error.layout.html.twig' %} + +{% block title %} + An Error Occurred: ({{ status_code }} {{ status_text }}) +{% endblock %} + +{% block body %} +
+ + + +
+{% endblock %} \ No newline at end of file diff --git a/app/Resources/TwigBundle/views/Exception/error.js.twig b/app/Resources/TwigBundle/views/Exception/error.js.twig new file mode 100644 index 0000000..d8a9369 --- /dev/null +++ b/app/Resources/TwigBundle/views/Exception/error.js.twig @@ -0,0 +1,4 @@ +/* +{{ status_code }} {{ status_text }} + +*/ diff --git a/app/Resources/TwigBundle/views/Exception/error.json.twig b/app/Resources/TwigBundle/views/Exception/error.json.twig new file mode 100644 index 0000000..fc19fd8 --- /dev/null +++ b/app/Resources/TwigBundle/views/Exception/error.json.twig @@ -0,0 +1 @@ +{{ { 'error': { 'code': status_code, 'message': status_text } }|json_encode|raw }} diff --git a/app/Resources/TwigBundle/views/Exception/error.rdf.twig b/app/Resources/TwigBundle/views/Exception/error.rdf.twig new file mode 100644 index 0000000..c27cc56 --- /dev/null +++ b/app/Resources/TwigBundle/views/Exception/error.rdf.twig @@ -0,0 +1 @@ +{% include '@Twig/Exception/error.xml.twig' %} diff --git a/app/Resources/TwigBundle/views/Exception/error.txt.twig b/app/Resources/TwigBundle/views/Exception/error.txt.twig new file mode 100644 index 0000000..bec5b1e --- /dev/null +++ b/app/Resources/TwigBundle/views/Exception/error.txt.twig @@ -0,0 +1,7 @@ +Oops! An Error Occurred +======================= + +The server returned a "{{ status_code }} {{ status_text }}". + +Something is broken. Please let us know what you were doing when this error occurred. +We will fix it as soon as possible. Sorry for any inconvenience caused. diff --git a/app/Resources/TwigBundle/views/Exception/error.xml.twig b/app/Resources/TwigBundle/views/Exception/error.xml.twig new file mode 100644 index 0000000..5ea8f56 --- /dev/null +++ b/app/Resources/TwigBundle/views/Exception/error.xml.twig @@ -0,0 +1,3 @@ + + + diff --git a/app/Resources/TwigBundle/views/Exception/exception.atom.twig b/app/Resources/TwigBundle/views/Exception/exception.atom.twig new file mode 100644 index 0000000..d507ce4 --- /dev/null +++ b/app/Resources/TwigBundle/views/Exception/exception.atom.twig @@ -0,0 +1 @@ +{% include '@Twig/Exception/exception.xml.twig' with { 'exception': exception } %} diff --git a/app/Resources/TwigBundle/views/Exception/exception.css.twig b/app/Resources/TwigBundle/views/Exception/exception.css.twig new file mode 100644 index 0000000..bdf242b --- /dev/null +++ b/app/Resources/TwigBundle/views/Exception/exception.css.twig @@ -0,0 +1,3 @@ +/* +{% include '@Twig/Exception/exception.txt.twig' with { 'exception': exception } %} +*/ diff --git a/app/Resources/TwigBundle/views/Exception/exception.html.twig b/app/Resources/TwigBundle/views/Exception/exception.html.twig new file mode 100644 index 0000000..72dea08 --- /dev/null +++ b/app/Resources/TwigBundle/views/Exception/exception.html.twig @@ -0,0 +1,123 @@ +
+
+
+ Exception detected! +
+
+
+ +
+ +

+ {{ exception.message|nl2br|format_file_from_text }} +

+ +
+ {{ status_code }} {{ status_text }} - {{ exception.class|abbr_class }} +
+ + {% set previous_count = exception.allPrevious|length %} + {% if previous_count %} +
{{ previous_count }} linked Exception{{ previous_count > 1 ? 's' : '' }}: +
    + {% for i, previous in exception.allPrevious %} +
  • + {{ previous.class|abbr_class }} » +
  • + {% endfor %} +
+
+ {% endif %} + +
+ +
+
+
+
+ +{% for position, e in exception.toarray %} + {% include '@Twig/Exception/traces.html.twig' with { 'exception': e, 'position': position, 'count': previous_count } only %} +{% endfor %} + +{% if logger %} +
+
+ {% spaceless %} +

+ Logs  + + + - + +

+ {% endspaceless %} + + {% if logger.counterrors %} +
+ + {{ logger.counterrors }} error{{ logger.counterrors > 1 ? 's' : ''}} + +
+ {% endif %} +
+ +
+ {% include '@Twig/Exception/logs.html.twig' with { 'logs': logger.logs } only %} +
+
+{% endif %} + +{% if currentContent %} +
+ {% spaceless %} +

+ Content of the Output  + + + + + +

+ {% endspaceless %} + + + +
+
+{% endif %} + +{% include '@Twig/Exception/traces_text.html.twig' with { 'exception': exception } only %} + + diff --git a/app/Resources/TwigBundle/views/Exception/exception.js.twig b/app/Resources/TwigBundle/views/Exception/exception.js.twig new file mode 100644 index 0000000..bdf242b --- /dev/null +++ b/app/Resources/TwigBundle/views/Exception/exception.js.twig @@ -0,0 +1,3 @@ +/* +{% include '@Twig/Exception/exception.txt.twig' with { 'exception': exception } %} +*/ diff --git a/app/Resources/TwigBundle/views/Exception/exception.json.twig b/app/Resources/TwigBundle/views/Exception/exception.json.twig new file mode 100644 index 0000000..13a4147 --- /dev/null +++ b/app/Resources/TwigBundle/views/Exception/exception.json.twig @@ -0,0 +1 @@ +{{ { 'error': { 'code': status_code, 'message': status_text, 'exception': exception.toarray } }|json_encode|raw }} diff --git a/app/Resources/TwigBundle/views/Exception/exception.rdf.twig b/app/Resources/TwigBundle/views/Exception/exception.rdf.twig new file mode 100644 index 0000000..d507ce4 --- /dev/null +++ b/app/Resources/TwigBundle/views/Exception/exception.rdf.twig @@ -0,0 +1 @@ +{% include '@Twig/Exception/exception.xml.twig' with { 'exception': exception } %} diff --git a/app/Resources/TwigBundle/views/Exception/exception.txt.twig b/app/Resources/TwigBundle/views/Exception/exception.txt.twig new file mode 100644 index 0000000..ae297c5 --- /dev/null +++ b/app/Resources/TwigBundle/views/Exception/exception.txt.twig @@ -0,0 +1,7 @@ +[exception] {{ status_code ~ ' | ' ~ status_text ~ ' | ' ~ exception.class }} +[message] {{ exception.message }} +{% for i, e in exception.toarray %} +[{{ i + 1 }}] {{ e.class }}: {{ e.message }} +{% include '@Twig/Exception/traces.txt.twig' with { 'exception': e } only %} + +{% endfor %} diff --git a/app/Resources/TwigBundle/views/Exception/exception.xml.twig b/app/Resources/TwigBundle/views/Exception/exception.xml.twig new file mode 100644 index 0000000..2e3f30a --- /dev/null +++ b/app/Resources/TwigBundle/views/Exception/exception.xml.twig @@ -0,0 +1,9 @@ + + + +{% for e in exception.toarray %} + +{% include '@Twig/Exception/traces.xml.twig' with { 'exception': e } only %} + +{% endfor %} + diff --git a/app/Resources/TwigBundle/views/Exception/exception_full.html.twig b/app/Resources/TwigBundle/views/Exception/exception_full.html.twig new file mode 100644 index 0000000..fa6f321 --- /dev/null +++ b/app/Resources/TwigBundle/views/Exception/exception_full.html.twig @@ -0,0 +1,13 @@ +{% extends '@Twig/layout.html.twig' %} + +{% block head %} + +{% endblock %} + +{% block title %} + {{ exception.message }} ({{ status_code }} {{ status_text }}) +{% endblock %} + +{% block body %} + {% include '@Twig/Exception/exception.html.twig' %} +{% endblock %} diff --git a/app/Resources/TwigBundle/views/Exception/logs.html.twig b/app/Resources/TwigBundle/views/Exception/logs.html.twig new file mode 100644 index 0000000..f75ec58 --- /dev/null +++ b/app/Resources/TwigBundle/views/Exception/logs.html.twig @@ -0,0 +1,7 @@ +
    + {% for log in logs %} + = 400 %} class="error"{% elseif log.priority >= 300 %} class="warning"{% endif %}> + {{ log.priorityName }} - {{ log.message }} + + {% endfor %} +
diff --git a/app/Resources/TwigBundle/views/Exception/trace.html.twig b/app/Resources/TwigBundle/views/Exception/trace.html.twig new file mode 100644 index 0000000..d00a376 --- /dev/null +++ b/app/Resources/TwigBundle/views/Exception/trace.html.twig @@ -0,0 +1,22 @@ +{% if trace.function %} + at + + {{ trace.short_class }} + {{ trace.type ~ trace.function }} + + ({{ trace.args|format_args }}) +{% endif %} + +{% if trace.file is defined and trace.file and trace.line is defined and trace.line %} + {{ trace.function ? '
' : '' }} + in {{ trace.file|format_file(trace.line) }}  + {% spaceless %} + + - + + + + {% endspaceless %} +
+ {{ trace.file|file_excerpt(trace.line) }} +
+{% endif %} diff --git a/app/Resources/TwigBundle/views/Exception/trace.txt.twig b/app/Resources/TwigBundle/views/Exception/trace.txt.twig new file mode 100644 index 0000000..ff20469 --- /dev/null +++ b/app/Resources/TwigBundle/views/Exception/trace.txt.twig @@ -0,0 +1,8 @@ +{% if trace.function %} + at {{ trace.class ~ trace.type ~ trace.function }}({{ trace.args|format_args_as_text }}) +{% else %} + at n/a +{% endif %} +{% if trace.file is defined and trace.line is defined %} + in {{ trace.file }} line {{ trace.line }} +{% endif %} diff --git a/app/Resources/TwigBundle/views/Exception/traces.html.twig b/app/Resources/TwigBundle/views/Exception/traces.html.twig new file mode 100644 index 0000000..e846f7a --- /dev/null +++ b/app/Resources/TwigBundle/views/Exception/traces.html.twig @@ -0,0 +1,25 @@ +
+ {% if count > 0 %} +

+ [{{ count - position + 1 }}/{{ count + 1 }}] + {{ exception.class|abbr_class }}: {{ exception.message|nl2br|format_file_from_text }}  + {% spaceless %} + + - + + + + {% endspaceless %} +

+ {% else %} +

Stack Trace

+ {% endif %} + + +
    + {% for i, trace in exception.trace %} +
  1. + {% include '@Twig/Exception/trace.html.twig' with { 'prefix': position, 'i': i, 'trace': trace } only %} +
  2. + {% endfor %} +
+
diff --git a/app/Resources/TwigBundle/views/Exception/traces.txt.twig b/app/Resources/TwigBundle/views/Exception/traces.txt.twig new file mode 100644 index 0000000..906be78 --- /dev/null +++ b/app/Resources/TwigBundle/views/Exception/traces.txt.twig @@ -0,0 +1,6 @@ +{% if exception.trace|length %} +{% for trace in exception.trace %} +{% include '@Twig/Exception/trace.txt.twig' with { 'trace': trace } only %} + +{% endfor %} +{% endif %} diff --git a/app/Resources/TwigBundle/views/Exception/traces.xml.twig b/app/Resources/TwigBundle/views/Exception/traces.xml.twig new file mode 100644 index 0000000..d04af93 --- /dev/null +++ b/app/Resources/TwigBundle/views/Exception/traces.xml.twig @@ -0,0 +1,8 @@ + +{% for trace in exception.trace %} + +{% include '@Twig/Exception/trace.txt.twig' with { 'trace': trace } only %} + + +{% endfor %} + diff --git a/app/Resources/TwigBundle/views/Exception/traces_text.html.twig b/app/Resources/TwigBundle/views/Exception/traces_text.html.twig new file mode 100644 index 0000000..16b3579 --- /dev/null +++ b/app/Resources/TwigBundle/views/Exception/traces_text.html.twig @@ -0,0 +1,18 @@ +
+

+ Stack Trace (Plain Text)  + {% spaceless %} + + + + + + {% endspaceless %} +

+ + +
diff --git a/app/Resources/TwigBundle/views/error.layout.html.twig b/app/Resources/TwigBundle/views/error.layout.html.twig new file mode 100644 index 0000000..d17952d --- /dev/null +++ b/app/Resources/TwigBundle/views/error.layout.html.twig @@ -0,0 +1,87 @@ + + + + + + + + + + {% block title %}{% endblock %} + + {% block head %} + + + + + + + + + + + + + + + + + + + {% endblock %} + + + + + {% block fullbody %} + + + + {% block body %}{% endblock%} + + + +
+ + + + Copyright © 2015 Paul Schweppe. All rights reserved. +
+ + + + + {% block footer %} + + + + + + + + + + + + + + + + + + + + + {% endblock %} + + {% block footerJS %} + {% endblock %} + + {% endblock %} + + diff --git a/app/Resources/TwigBundle/views/layout.html.twig b/app/Resources/TwigBundle/views/layout.html.twig new file mode 100644 index 0000000..5672135 --- /dev/null +++ b/app/Resources/TwigBundle/views/layout.html.twig @@ -0,0 +1,44 @@ + + + + + + {% block title %}{% endblock %} + + + {% block head %}{% endblock %} + + +
+
+ + + +
+ +
+ {% block body %}{% endblock %} +
+
+ + diff --git a/src/VersionControl/GitControlBundle/Resources/public/theme/css/custom.css b/src/VersionControl/GitControlBundle/Resources/public/theme/css/custom.css index 2e975ff..c9c8af9 100644 --- a/src/VersionControl/GitControlBundle/Resources/public/theme/css/custom.css +++ b/src/VersionControl/GitControlBundle/Resources/public/theme/css/custom.css @@ -488,3 +488,36 @@ a.environment-info-btn.active>.fa-angle-left { transform: rotate(-90deg); } +.error-box{ + width: 700px; + margin: 3% auto; + background: #fff; + padding: 20px; + box-shadow: 5px 5px 10px #888888; +} + +.error-box-body { + background: #fff; + border-top: 0; + color: #666; +} + +.error-box-body .headline{ + margin: 0; + padding: 0; + float: left; + font-size: 100px; + font-weight: 300; + line-height: 70px; +} +.error-box-body>.error-content { + margin-left: 190px; + display: block; +} + +.error-box-body>.error-content>h3 { + font-weight: 300; + font-size: 25px; + margin-top: 0; +} + From 2a3be4c008f8152b8c09e3bbfb44ce3bbe282333 Mon Sep 17 00:00:00 2001 From: Paul Schweppe Date: Wed, 12 Oct 2016 16:24:09 +0100 Subject: [PATCH 09/60] Added diff filter to file comparison to compare to file to all previous commits related to a file --- .../GitCommands/Command/GitDiffCommand.php | 20 ++++++++++-- .../GitCommands/Command/GitLogCommand.php | 29 +++++++++++++++-- .../Controller/ProjectHistoryController.php | 32 ++++++++++++++++--- .../views/ProjectHistory/fileDiff.html.twig | 22 +++++++++++-- 4 files changed, 91 insertions(+), 12 deletions(-) diff --git a/src/VersionControl/GitCommandBundle/GitCommands/Command/GitDiffCommand.php b/src/VersionControl/GitCommandBundle/GitCommands/Command/GitDiffCommand.php index 883cd87..c535d20 100644 --- a/src/VersionControl/GitCommandBundle/GitCommands/Command/GitDiffCommand.php +++ b/src/VersionControl/GitCommandBundle/GitCommands/Command/GitDiffCommand.php @@ -38,7 +38,7 @@ public function getCommitDiff($commitHash){ * @return array() */ public function getDiffFile($filename){ - $diffString = $this->command->runCommand("git --no-pager diff --oneline ".escapeshellarg($filename)." 2>&1"); + $diffString = $this->command->runCommand("git --no-pager diff --oneline ".escapeshellarg($filename).""); $diffParser = new GitDiffParser($diffString); $diffs = $diffParser->parse(); return $diffs; @@ -49,7 +49,7 @@ public function getDiffFile($filename){ * @return array() */ public function getDiffFileBetweenCommits($filename,$previousCommitHash,$commitHash){ - $diffString = $this->command->runCommand("git --no-pager diff --oneline ".escapeshellarg($previousCommitHash)." ".escapeshellarg($commitHash)." ".escapeshellarg($filename)." 2>&1"); + $diffString = $this->command->runCommand("git --no-pager diff --oneline ".escapeshellarg($previousCommitHash)." ".escapeshellarg($commitHash)." -- ".escapeshellarg($filename).""); $diffParser = new GitDiffParser($diffString); $diffs = $diffParser->parse(); return $diffs; @@ -86,6 +86,22 @@ public function getPreviousCommitHash($commitHash = 'HEAD',$fileName = false){ } + public function getAllPreviousCommitHash($commitHash = 'HEAD',$fileName = false){ + $previousCommitHash = ''; + $command = " git log --pretty=format:'%h' -n 60 ".escapeshellarg($commitHash).""; + if($fileName !== false){ + $command .= " ".escapeshellarg($fileName); + } + $response = $this->command->runCommand($command); + $responseLines = $this->splitOnNewLine($response); + if(count($responseLines) == 2){ + $previousCommitHash = trim($responseLines['1']); + } + + return $previousCommitHash; + + } + } \ No newline at end of file diff --git a/src/VersionControl/GitCommandBundle/GitCommands/Command/GitLogCommand.php b/src/VersionControl/GitCommandBundle/GitCommands/Command/GitLogCommand.php index a51e81b..40052f9 100644 --- a/src/VersionControl/GitCommandBundle/GitCommands/Command/GitLogCommand.php +++ b/src/VersionControl/GitCommandBundle/GitCommands/Command/GitLogCommand.php @@ -73,6 +73,12 @@ class GitLogCommand extends AbstractGitCommand { */ protected $branch; + /** + * Filter log by path. File name should include the path relative to git folder. Only returns commits that effect this file + * @var string + */ + protected $path; + /** * Enables the --not --remotes flags. Returns commits that have not been * pushed to a remote server. @@ -198,8 +204,7 @@ public function getLogCommand(){ } if($this->branch){ - //Need to append -- do tell git that its a branch and not a file - $this->logCommand .= ' '.escapeshellarg(trim($this->branch)).' --'; + $this->logCommand .= ' '.escapeshellarg(trim($this->branch)); }elseif(!$this->commitHash){ $this->logCommand .= ' --all'; } @@ -207,6 +212,14 @@ public function getLogCommand(){ if($this->notRemote){ $this->logCommand .= ' --not --remotes'; } + + //To prevent confusion with options and branch names, paths may need to be prefixed with "-- " to separate them from options or refnames. + $this->logCommand .= ' --'; + + //Show only commits that affect any of the specified paths. + if($this->path){ + $this->logCommand .= ' '.escapeshellarg(trim($this->path)); + } return $this->logCommand; } @@ -427,6 +440,18 @@ public function setFilterByContent($filterByContent) { return $this; } + public function getPath() { + return $this->path; + } + + public function setPath($path) { + $this->path = $path; + return $this; + } + + + + } \ No newline at end of file diff --git a/src/VersionControl/GitControlBundle/Controller/ProjectHistoryController.php b/src/VersionControl/GitControlBundle/Controller/ProjectHistoryController.php index 27f5f0d..359495b 100644 --- a/src/VersionControl/GitControlBundle/Controller/ProjectHistoryController.php +++ b/src/VersionControl/GitControlBundle/Controller/ProjectHistoryController.php @@ -152,24 +152,46 @@ public function commitHistoryAction($id,$commitHash){ /** * Show Git commit diff * - * @Route("/commitfile/{commitHash}/{filePath}", name="project_commitfilediff") + * @Route("/commitfile/{commitHash}/{filePath}/{diffCommitHash}", name="project_commitfilediff" , defaults={"diffCommitHash" = 0}) * @Method("GET") * @Template() * @ProjectAccess(grantType="VIEW") */ - public function fileDiffAction($id,$commitHash,$filePath){ + public function fileDiffAction($id,$commitHash,$filePath,$diffCommitHash){ $gitDiffCommand = $this->gitCommands->command('diff'); $difffile = urldecode($filePath); - $previousCommitHash = $gitDiffCommand->getPreviousCommitHash($commitHash,$difffile); - + if($diffCommitHash){ + $previousCommitHash = $diffCommitHash; + }else{ + $previousCommitHash = $gitDiffCommand->getPreviousCommitHash($commitHash,$difffile); + } + if(!$previousCommitHash){ + $previousCommitHash = 'HEAD'; + } + $gitDiffs = $gitDiffCommand->getDiffFileBetweenCommits($difffile,$previousCommitHash,$commitHash); - + + $this->gitLogCommand + ->setLogCount(60) + ->setCommitHash($commitHash) + ->setPath($difffile) + ->setLimit(60); + + $gitPreviousLogs= $this->gitLogCommand->execute()->getResults(); + + //First element is current commit so need to remove first element + array_shift($gitPreviousLogs); + return array_merge($this->viewVariables, array( 'diffs' => $gitDiffs, + 'previousLogs' => $gitPreviousLogs, + 'commitHash' => $commitHash, + 'diffCommitHash' => $previousCommitHash, + 'filePath' => $difffile )); } diff --git a/src/VersionControl/GitControlBundle/Resources/views/ProjectHistory/fileDiff.html.twig b/src/VersionControl/GitControlBundle/Resources/views/ProjectHistory/fileDiff.html.twig index 30b75ea..13c2748 100644 --- a/src/VersionControl/GitControlBundle/Resources/views/ProjectHistory/fileDiff.html.twig +++ b/src/VersionControl/GitControlBundle/Resources/views/ProjectHistory/fileDiff.html.twig @@ -4,8 +4,16 @@
- @@ -198,18 +209,18 @@ - + {% endblock %} - {% block footerJS %} - - - - + + diff --git a/src/VersionControl/GitControlBundle/Resources/views/ProjectHistory/list.html.twig b/src/VersionControl/GitControlBundle/Resources/views/ProjectHistory/list.html.twig index 2c05516..0d12613 100644 --- a/src/VersionControl/GitControlBundle/Resources/views/ProjectHistory/list.html.twig +++ b/src/VersionControl/GitControlBundle/Resources/views/ProjectHistory/list.html.twig @@ -32,6 +32,12 @@ {% block content -%} + {% if (is_granted('EDIT', project)) %} + {% set hasEditAccess = 'true' %} + {% else %} + {% set hasEditAccess = null %} + {% endif %} +
+ {% if hasEditAccess is not null %} + {% endif %}
diff --git a/src/VersionControl/GitControlBundle/Resources/views/ProjectIndex/index.html.twig b/src/VersionControl/GitControlBundle/Resources/views/ProjectIndex/index.html.twig index 22e9d74..ab0bbba 100644 --- a/src/VersionControl/GitControlBundle/Resources/views/ProjectIndex/index.html.twig +++ b/src/VersionControl/GitControlBundle/Resources/views/ProjectIndex/index.html.twig @@ -29,7 +29,11 @@ {% if (section) %} var defaultPage = "{{ section }}"; {% else %} + {% if (is_granted('EDIT', project)) %} var defaultPage = "{{ path('project_commitlist', { 'id': project.id }) }}"; + {% else %} + var defaultPage = "{{ path('project_filelist', { 'id': project.id }) }}"; + {% endif %} {% endif %} diff --git a/src/VersionControl/GitControlBundle/Resources/views/ProjectTag/tags.html.twig b/src/VersionControl/GitControlBundle/Resources/views/ProjectTag/tags.html.twig index e91f07b..54f662b 100644 --- a/src/VersionControl/GitControlBundle/Resources/views/ProjectTag/tags.html.twig +++ b/src/VersionControl/GitControlBundle/Resources/views/ProjectTag/tags.html.twig @@ -30,6 +30,12 @@ {% endblock %} {% block content -%} + {% if (is_granted('EDIT', project)) %} + {% set hasEditAccess = 'true' %} + {% else %} + {% set hasEditAccess = null %} + {% endif %} +

@@ -74,6 +80,7 @@

+ {% if hasEditAccess is not null %}
- + {% endif %}
From d05f3cc946002f759d049ec61afbbeadfc2701e9 Mon Sep 17 00:00:00 2001 From: Paul Schweppe Date: Thu, 18 May 2017 22:42:13 +0100 Subject: [PATCH 35/60] Add unit test for Tag Commands --- .../GitCommands/Command/GitTagCommandTest.php | 106 ++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 src/VersionControl/GitCommandBundle/Tests/GitCommands/Command/GitTagCommandTest.php diff --git a/src/VersionControl/GitCommandBundle/Tests/GitCommands/Command/GitTagCommandTest.php b/src/VersionControl/GitCommandBundle/Tests/GitCommands/Command/GitTagCommandTest.php new file mode 100644 index 0000000..ee39d92 --- /dev/null +++ b/src/VersionControl/GitCommandBundle/Tests/GitCommands/Command/GitTagCommandTest.php @@ -0,0 +1,106 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace VersionControl\GitCommandBundle\Tests\GitCommands\Command; + +use VersionControl\GitCommandBundle\Tests\GitCommandTestCase; + +/** + * Description of GitBranchCommandTest. + * + * @author fr_user + */ +class GitTagCommandTest extends GitCommandTestCase +{ + /** + * setUp, called on every method. + */ + public function setUp() + { + $this->initGitCommandsLocal(); + $this->gitCommands->command('init')->initRepository(); + $this->addFile('test'); + $this->gitCommands->command('commit')->stageAll(); + $this->gitCommands->command('commit')->commit('first commit', 'Paul Schweppe '); + $this->addFile('test2'); + $this->gitCommands->command('commit')->stageAll(); + $this->gitCommands->command('commit')->commit('Second commit', 'Paul Schweppe '); + } + + /** + * Test current branch. + */ + public function testGetTagsNoTags() + { + $tags = $this->gitCommands->command('tag')->getTags(); + $this->assertCount(0, $tags,'Tag count does not equal expected 0. Actual:'.count($tags)); + } + + /** + * Test create local branch. + */ + public function testCreateAnnotatedTag() + { + $tagCommand = $this->gitCommands->command('tag'); + + $this->assertEquals('', $tagCommand->createAnnotatedTag('tag1','Test of tag1'), 'create tag command'); + + $tags = $this->gitCommands->command('tag')->getTags(); + $this->assertCount(1, $tags,'Tag count does not equal expected 1. Actual:'.count($tags)); + + $errorMessage = ''; + try { + $tagCommand->createAnnotatedTag('tag1','Test of tag1'); + } catch (\VersionControl\GitCommandBundle\GitCommands\Exception\RunGitCommandException $e) { + $errorMessage = $e->getMessage(); + } + $this->assertEquals("fatal: tag 'tag1' already exists", trim($errorMessage), 'create branch command error'); + } + + public function testPushTag() + { + $tagCommand = $this->gitCommands->command('tag'); + + $this->assertEquals('', $tagCommand->createAnnotatedTag('tag1','Test of tag1'), 'create tag command'); + + // + try { + $this->assertEquals('', $tagCommand->pushTag('origin','tag1'), 'Push tag1 to origin'); + }catch (\VersionControl\GitCommandBundle\GitCommands\Exception\RunGitCommandException $e) { + $errorMessage = $e->getMessage(); + } + $this->assertContains("fatal: 'origin' does not appear to be a git repository", trim($errorMessage), 'push tag command error'); + + } + + + + + + /** + * Test branch names. + */ + public function testValidateTagName() + { + $this->assertTrue($this->gitCommands->command('branch')->validateBranchName('test'), 'Branch name "test" should be valid'); + $this->assertTrue($this->gitCommands->command('branch')->validateBranchName('test1232'), 'Branch name "test" should be valid'); + $this->assertTrue($this->gitCommands->command('branch')->validateBranchName('test!£$test'), 'Branch name "test!£$test" should be valid'); + + $this->assertFalse($this->gitCommands->command('branch')->validateBranchName('..test'), 'Branch name "..test" should be invalid'); + $this->assertFalse($this->gitCommands->command('branch')->validateBranchName('te:st'), 'Branch name "te:st" should be invalid'); + $this->assertFalse($this->gitCommands->command('branch')->validateBranchName('te~st'), 'Branch name "te~st" should be invalid'); + $this->assertFalse($this->gitCommands->command('branch')->validateBranchName('te^st'), 'Branch name "te^st" should be invalid'); + $this->assertFalse($this->gitCommands->command('branch')->validateBranchName('test/'), 'Branch name "test/" should be invalid'); + $this->assertFalse($this->gitCommands->command('branch')->validateBranchName('\test'), 'Branch name "\test" should be invalid'); + $this->assertFalse($this->gitCommands->command('branch')->validateBranchName('test test'), 'Branch name "test test" should be invalid'); + } + + +} From d6e69f008ccc80efa1a002ea2dead1ee0b0a149c Mon Sep 17 00:00:00 2001 From: Paul Schweppe Date: Fri, 19 May 2017 13:30:24 +0100 Subject: [PATCH 36/60] GitFilesCommand now uses the GitLogCommand instead of replicating functionality to get file logs --- .../GitCommands/Command/GitFilesCommand.php | 47 ++++--------------- 1 file changed, 10 insertions(+), 37 deletions(-) diff --git a/src/VersionControl/GitCommandBundle/GitCommands/Command/GitFilesCommand.php b/src/VersionControl/GitCommandBundle/GitCommands/Command/GitFilesCommand.php index 90709be..0d5558c 100644 --- a/src/VersionControl/GitCommandBundle/GitCommands/Command/GitFilesCommand.php +++ b/src/VersionControl/GitCommandBundle/GitCommands/Command/GitFilesCommand.php @@ -65,7 +65,7 @@ protected function getFileInfo($path) $fileInfo = null; if ($this->validPathStr($path) === false) { - throw new \Exception('Directory path is not valid. Possible security issue.'); + throw new \VersionControl\GitCommandBundle\GitCommands\Exception\InvalidDirectoryException('Directory path is not valid. Possible security issue.'); } $basePath = $this->addEndingSlash($this->command->getGitEnvironment()->getPath()); @@ -146,7 +146,7 @@ protected function sortFilesByDirectoryThenName(array &$fileArray) public function getFilesInDirectory($dir) { if ($this->validPathStr($dir) === false) { - throw new \Exception('Directory path is not valid. Possible security issue.'); + throw new \VersionControl\GitCommandBundle\GitCommands\Exception\InvalidDirectoryException('Directory path is not valid. Possible security issue.'); } $files = array(); @@ -271,42 +271,15 @@ public function setFilesOwnerAndGroup($filePaths, $user = 'www-data', $group = ' */ public function getLog($count = 20, $branch = 'master', $fileName = false) { - $logs = array(); - $logData = ''; - try { - //$logData = $this->command->runCommand('git --no-pager log --pretty=format:"%H | %h | %T | %t | %P | %p | %an | %ae | %ad | %ar | %cn | %ce | %cd | %cr | %s" -'.intval($count).' '.$branch); - $command = 'git --no-pager log -m "--pretty=format:\'%H | %h | %T | %t | %P | %p | %an | %ae | %ad | %ar | %cn | %ce | %cd | %cr | %s\'" -'.intval($count).' '; - if ($branch && $branch != '(No Branch)') { - $command .= escapeshellarg(trim($branch)).' '; - } else { - $command .= '-- '; - } - if ($fileName !== false) { - $command .= ' -- '.escapeshellarg($fileName); - } else { - $command .= ' --'; - } - $logData = $this->command->runCommand($command); - } catch (RunGitCommandException $e) { - if ($this->getObjectCount() == 0) { - return $logs; - } else { - throw new RunGitCommandException('Error in get log Command:'.$e->getMessage()); - //Throw exception - } - } - - $lines = $this->splitOnNewLine($logData); - - if (is_array($lines) && count($lines) > 0) { - foreach ($lines as $line) { - if (trim($line)) { - $logs[] = new GitLog($line); - } - } - } + + $gitLogCommand = $this->command->command('log'); + + $gitLogCommand->setLogCount($count); + $gitLogCommand->setBranch($branch); + $gitLogCommand->setPath($fileName); + + return $gitLogCommand->execute()->getResults(); - return $logs; } /** From 0ed38e52930f366d2894d454c3c7e393c1236e12 Mon Sep 17 00:00:00 2001 From: Paul Schweppe Date: Fri, 19 May 2017 13:30:52 +0100 Subject: [PATCH 37/60] Create Exception for invalid directory --- .../Exception/InvalidDirectoryException.php | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/VersionControl/GitCommandBundle/GitCommands/Exception/InvalidDirectoryException.php diff --git a/src/VersionControl/GitCommandBundle/GitCommands/Exception/InvalidDirectoryException.php b/src/VersionControl/GitCommandBundle/GitCommands/Exception/InvalidDirectoryException.php new file mode 100644 index 0000000..8bbc483 --- /dev/null +++ b/src/VersionControl/GitCommandBundle/GitCommands/Exception/InvalidDirectoryException.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace VersionControl\GitCommandBundle\GitCommands\Exception; + +/** + * InvalidArgumentException. + * + * @author Paul Schweppe + */ +class InvalidDirectoryException extends \Exception implements ExceptionInterface +{ +} From 3de1da2c0d2ea2431e89daf77d51358a8be369fe Mon Sep 17 00:00:00 2001 From: Paul Schweppe Date: Fri, 19 May 2017 14:13:03 +0100 Subject: [PATCH 38/60] Added Git Files Command Tests --- .../GitCommands/Command/GitFilesCommand.php | 1 + .../Exception/InvalidDirectoryException.php | 2 +- .../Command/GitFilesCommandTest.php | 93 +++++++++++++++++++ 3 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 src/VersionControl/GitCommandBundle/Tests/GitCommands/Command/GitFilesCommandTest.php diff --git a/src/VersionControl/GitCommandBundle/GitCommands/Command/GitFilesCommand.php b/src/VersionControl/GitCommandBundle/GitCommands/Command/GitFilesCommand.php index 0d5558c..30b398c 100644 --- a/src/VersionControl/GitCommandBundle/GitCommands/Command/GitFilesCommand.php +++ b/src/VersionControl/GitCommandBundle/GitCommands/Command/GitFilesCommand.php @@ -89,6 +89,7 @@ protected function getFileInfo($path) $fileInfo = $newFileInfo; } + return $fileInfo; } diff --git a/src/VersionControl/GitCommandBundle/GitCommands/Exception/InvalidDirectoryException.php b/src/VersionControl/GitCommandBundle/GitCommands/Exception/InvalidDirectoryException.php index 8bbc483..1bc2cfc 100644 --- a/src/VersionControl/GitCommandBundle/GitCommands/Exception/InvalidDirectoryException.php +++ b/src/VersionControl/GitCommandBundle/GitCommands/Exception/InvalidDirectoryException.php @@ -12,7 +12,7 @@ namespace VersionControl\GitCommandBundle\GitCommands\Exception; /** - * InvalidArgumentException. + * InvalidDirectoryException. * * @author Paul Schweppe */ diff --git a/src/VersionControl/GitCommandBundle/Tests/GitCommands/Command/GitFilesCommandTest.php b/src/VersionControl/GitCommandBundle/Tests/GitCommands/Command/GitFilesCommandTest.php new file mode 100644 index 0000000..fd83801 --- /dev/null +++ b/src/VersionControl/GitCommandBundle/Tests/GitCommands/Command/GitFilesCommandTest.php @@ -0,0 +1,93 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace VersionControl\GitCommandBundle\Tests\GitCommands\Command; + +use VersionControl\GitCommandBundle\Tests\GitCommandTestCase; + +/** + * GitFilesCommandTest. + * @author Paul Schweppe + */ +class GitFilesCommandTest extends GitCommandTestCase +{ + /** + * setUp, called on every method. + */ + public function setUp() + { + $this->initGitCommandsLocal(); + $this->gitCommands->command('init')->initRepository(); + $this->addFile('test',null,'Test Of List Files'); + $this->addFolder('MoreFiles'); + $this->addFile('test2','MoreFiles','Test Of file in MoreFiles folder'); + + $this->gitCommands->command('commit')->stageAll(); + $this->gitCommands->command('commit')->commit('first commit', 'Paul Schweppe '); + + $this->addFile('test3',null,'This file is not commited'); + + + } + + /** + * Test list files. + */ + public function testListFiles() + { + $files = $this->gitCommands->command('files')->listFiles(''); + + $this->assertCount(3, $files,'File list count does not equal expected 3. Actual:'.count($files)); + + foreach($files as $file){ + $this->assertInstanceOf("\SplFileInfo", $file); + } + + $this->assertTrue($files[0]->isDir(), 'First file should be a directory'); + $this->assertTrue($files[1]->isFile(), 'Second file should be a file'); + + $this->assertInstanceOf("\VersionControl\GitCommandBundle\Entity\GitLog", $files[1]->getGitLog()); + $this->assertNull($files[2]->getGitLog(), 'Third file should not have a git log'); + + $errorMessage = ''; + try{ + $this->gitCommands->command('files')->listFiles('../'); + }catch(\VersionControl\GitCommandBundle\GitCommands\Exception\InvalidDirectoryException $e){ + $errorMessage = $e->getMessage(); + } + $this->assertContains("Directory path is not valid", trim($errorMessage), 'Invalid Directory error'); + } + + /** + * Test Get File + */ + public function testGetFile() + { + $file = $this->gitCommands->command('files')->getFile('MoreFiles/test2'); + $this->assertTrue($file->isFile(), ''); + $this->assertInstanceOf("\SplFileInfo", $file); + $this->assertInstanceOf("\VersionControl\GitCommandBundle\Entity\GitLog", $file->getGitLog()); + + + $errorMessage = ''; + try{ + $fileNotExisting = $this->gitCommands->command('files')->getFile('MoreFiles/testDoesNotExist'); + }catch(\VersionControl\GitCommandBundle\GitCommands\Exception\InvalidDirectoryException $e){ + $errorMessage = $e->getMessage(); + } + + $this->assertFalse($fileNotExisting->getRealPath(), ''); + //$this->assertContains("Directory path is not valid", trim($errorMessage), 'Invalid Directory error:'.$errorMessage); + } + + + + +} From c3c3220d3c90142175baf9098ba1a2cdc958f416 Mon Sep 17 00:00:00 2001 From: Paul Schweppe Date: Sat, 20 May 2017 19:45:22 +0100 Subject: [PATCH 39/60] Unit Test for Git Commands Fixed ignore file --- .../GitCommandBundle/Entity/FileInfo.php | 4 +- .../Entity/FileInfoInterface.php | 50 +++++++ .../Entity/RemoteFileInfo.php | 4 +- .../GitCommands/Command/GitFilesCommand.php | 73 ++++++++-- .../Exception/FileStatusException.php | 21 +++ .../Exception/InvalidFilePathException.php | 21 +++ .../Command/GitFilesCommandTest.php | 126 ++++++++++++++++++ 7 files changed, 286 insertions(+), 13 deletions(-) create mode 100644 src/VersionControl/GitCommandBundle/Entity/FileInfoInterface.php create mode 100644 src/VersionControl/GitCommandBundle/GitCommands/Exception/FileStatusException.php create mode 100644 src/VersionControl/GitCommandBundle/GitCommands/Exception/InvalidFilePathException.php diff --git a/src/VersionControl/GitCommandBundle/Entity/FileInfo.php b/src/VersionControl/GitCommandBundle/Entity/FileInfo.php index 4e674ba..09e0390 100644 --- a/src/VersionControl/GitCommandBundle/Entity/FileInfo.php +++ b/src/VersionControl/GitCommandBundle/Entity/FileInfo.php @@ -12,6 +12,8 @@ namespace VersionControl\GitCommandBundle\Entity; +use VersionControl\GitCommandBundle\Entity\FileInfoInterface; + /** * Info on Local file including git log and path. * @@ -19,7 +21,7 @@ * * @author Paul Schweppe */ -class FileInfo extends \SplFileInfo +class FileInfo extends \SplFileInfo implements FileInfoInterface { /** * File full path to file. diff --git a/src/VersionControl/GitCommandBundle/Entity/FileInfoInterface.php b/src/VersionControl/GitCommandBundle/Entity/FileInfoInterface.php new file mode 100644 index 0000000..9e3c677 --- /dev/null +++ b/src/VersionControl/GitCommandBundle/Entity/FileInfoInterface.php @@ -0,0 +1,50 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace VersionControl\GitCommandBundle\Entity; + +/** + * Info on Local file including git log and path. + * + * @link http://php.net/manual/en/class.splfileinfo.php + * + * @author Paul Schweppe + */ +interface FileInfoInterface{ + + /* + * Get Functions + */ + public function getExtension(); + public function getFilename(); + public function getPath(); + public function getPerms(); + public function getSize(); + public function getATime(); + public function getMTime(); + public function getType(); + + public function getFullPath(); + public function getGitPath(); + public function getGitLog(); + + /* + * Set Functions + */ + public function setGitPath($gitPath); + public function setGitLog(GitLog $gitLog); + + public function isDir(); + public function isFile(); + public function isLink(); + +} diff --git a/src/VersionControl/GitCommandBundle/Entity/RemoteFileInfo.php b/src/VersionControl/GitCommandBundle/Entity/RemoteFileInfo.php index 5111931..dd258d6 100644 --- a/src/VersionControl/GitCommandBundle/Entity/RemoteFileInfo.php +++ b/src/VersionControl/GitCommandBundle/Entity/RemoteFileInfo.php @@ -12,12 +12,14 @@ namespace VersionControl\GitCommandBundle\Entity; +use VersionControl\GitCommandBundle\Entity\FileInfoInterface; + /** * Remote File Info. * * @author Paul Schweppe */ -class RemoteFileInfo +class RemoteFileInfo implements FileInfoInterface { /** * Absolute path to file. diff --git a/src/VersionControl/GitCommandBundle/GitCommands/Command/GitFilesCommand.php b/src/VersionControl/GitCommandBundle/GitCommands/Command/GitFilesCommand.php index 30b398c..1325881 100644 --- a/src/VersionControl/GitCommandBundle/GitCommands/Command/GitFilesCommand.php +++ b/src/VersionControl/GitCommandBundle/GitCommands/Command/GitFilesCommand.php @@ -192,7 +192,12 @@ public function getFilesInDirectory($dir) return $files; } - public function readFile($file) + /** + * Read Git File + * @param \VersionControl\GitCommandBundle\Entity\FileInfoInterface $file + * @return string file contents + */ + public function readFile(\VersionControl\GitCommandBundle\Entity\FileInfoInterface $file) { //$basePath = $this->addEndingSlash($this->command->getGitEnvironment()->getPath()); $fileContents = ''; @@ -223,7 +228,8 @@ public function readFile($file) */ public function validPathStr($theFile) { - if (strpos($theFile, '//') === false && strpos($theFile, '\\') === false && !preg_match('#(?:^\\.\\.|/\\.\\./|[[:cntrl:]])#u', $theFile)) { + if (strpos($theFile, '//') === false && strpos($theFile, '\\') === false && strpos($theFile, '/') !== 0 && strpos($theFile, '\\') !== 0 && preg_match('#(?:^\\.\\.|/\\.\\./|.git|[[:cntrl:]])#u', $theFile) === 0) + { return true; } @@ -326,25 +332,70 @@ public function isFileIgnored($filePath) public function isFileTracked($filePath) { $response = $this->command->runCommand(sprintf('git ls-files %s', escapeshellarg($filePath))); - - return $response ? true : false; + + return trim($response) === '' ? false : true; } + /** + * Ignore a file by adding to gitignore + * @param string $filePath + * @return string + * @throws \VersionControl\GitCommandBundle\GitCommands\Exception\FileStatusException + * @throws \VersionControl\GitCommandBundle\GitCommands\Exception\InvalidFilePathException + */ public function ignoreFile($filePath) { $response = ''; if ($this->fileExists($filePath)) { - if ($this->filePathIsIgnored($filePath) === false) { + + if($this->isFileTracked($filePath)){ + throw new \VersionControl\GitCommandBundle\GitCommands\Exception\FileStatusException('File path is been tracked. Please untrack file first'); + } + + if($this->isFileIgnored($filePath) === false){ $response = $this->addToGitIgnore($filePath); - } else { - $response = "File in .gitignore already.\n"; + }else { + throw new \VersionControl\GitCommandBundle\GitCommands\Exception\FileStatusException('File path is already ignored'); } - $response .= $this->command->runCommand(sprintf('git rm --cached %s', escapeshellarg($filePath))); + } else { + throw new \VersionControl\GitCommandBundle\GitCommands\Exception\InvalidFilePathException('File path was not valid. Please check that the file exists.'); + } + + return $response; + } + + /** + * Removes file path from git index + * + * Update your .gitignore file – for instance, add a folder you don't want to track to .gitignore . + * git rm -r --cached . – Remove all tracked files, including wanted and unwanted. Your code will be safe as long as you have saved locally. + * git add . – All files will be added back in, except those in .gitignore . + * + * @param string $filePath + * @return string + * @throws \VersionControl\GitCommandBundle\GitCommands\Exception\FileStatusException + * @throws \VersionControl\GitCommandBundle\GitCommands\Exception\InvalidFilePathException + */ + public function unTrackFile($filePath) + { + $response = ''; + if ($this->fileExists($filePath)) { + + if($this->isFileTracked($filePath)){ + $statusCount = $this->command->command('commit')->countStatus(); + if($statusCount <= 0){ + $response .= $this->command->runCommand(sprintf('git rm --cached %s', escapeshellarg($filePath))); + $response .= "\n Please commit to complete the removal of this file from git index"; + }else{ + throw new \VersionControl\GitCommandBundle\GitCommands\Exception\FileStatusException('Please commit all files first'); + } + }else{ + throw new \VersionControl\GitCommandBundle\GitCommands\Exception\FileStatusException('File path is not been tracked'); + } - $response .= "\n Please commit to complete the removal of this file from git index"; } else { - throw new \Exception('File path was not valid. Please check that the file exists.'); + throw new \VersionControl\GitCommandBundle\GitCommands\Exception\InvalidFilePathException('File path was not valid. Please check that the file exists.'); } return $response; @@ -420,6 +471,6 @@ public function addToGitIgnore($filePath) //create file } - return "File added to .gitignore\n"; + return "File added to .gitignore"; } } diff --git a/src/VersionControl/GitCommandBundle/GitCommands/Exception/FileStatusException.php b/src/VersionControl/GitCommandBundle/GitCommands/Exception/FileStatusException.php new file mode 100644 index 0000000..cb95047 --- /dev/null +++ b/src/VersionControl/GitCommandBundle/GitCommands/Exception/FileStatusException.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace VersionControl\GitCommandBundle\GitCommands\Exception; + +/** + * InvalidDirectoryException. + * + * @author Paul Schweppe + */ +class FileStatusException extends \Exception implements ExceptionInterface +{ +} diff --git a/src/VersionControl/GitCommandBundle/GitCommands/Exception/InvalidFilePathException.php b/src/VersionControl/GitCommandBundle/GitCommands/Exception/InvalidFilePathException.php new file mode 100644 index 0000000..d918a7c --- /dev/null +++ b/src/VersionControl/GitCommandBundle/GitCommands/Exception/InvalidFilePathException.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace VersionControl\GitCommandBundle\GitCommands\Exception; + +/** + * InvalidDirectoryException. + * + * @author Paul Schweppe + */ +class InvalidFilePathException extends \Exception implements ExceptionInterface +{ +} diff --git a/src/VersionControl/GitCommandBundle/Tests/GitCommands/Command/GitFilesCommandTest.php b/src/VersionControl/GitCommandBundle/Tests/GitCommands/Command/GitFilesCommandTest.php index fd83801..38da270 100644 --- a/src/VersionControl/GitCommandBundle/Tests/GitCommands/Command/GitFilesCommandTest.php +++ b/src/VersionControl/GitCommandBundle/Tests/GitCommands/Command/GitFilesCommandTest.php @@ -87,7 +87,133 @@ public function testGetFile() //$this->assertContains("Directory path is not valid", trim($errorMessage), 'Invalid Directory error:'.$errorMessage); } + /** + * Test Read File + */ + public function testReadFile(){ + $file = $this->gitCommands->command('files')->getFile('MoreFiles/test2'); + $fileContent = $this->gitCommands->command('files')->readFile($file); + $this->assertContains("Test Of file in MoreFiles folder", trim($fileContent), 'File content did not match:'.$fileContent); + + } + /** + * Test malicious file paths + */ + public function testValidPathStr(){ + + $filesCommand = $this->gitCommands->command('files'); + $this->assertTrue($filesCommand->ValidPathStr('MoreFiles/test2'), 'Path "MoreFiles/test2" should be valid'); + $this->assertFalse($filesCommand->ValidPathStr('/MoreFiles/test2'), 'Path "/MoreFiles/test2" should be valid'); + $this->assertFalse($filesCommand->ValidPathStr('.git/config'), 'Path ".git/config" should be valid'); + $this->assertFalse($filesCommand->ValidPathStr('/'), 'Path "/" should be valid'); + $this->assertFalse($filesCommand->ValidPathStr('/../'), 'Path "/../" should be valid'); + $this->assertFalse($filesCommand->ValidPathStr('//test'), 'Path "//test" should be valid'); + $this->assertFalse($filesCommand->ValidPathStr('\test'), 'Path "\test" should be valid'); + + $this->assertTrue($filesCommand->ValidPathStr('test/test/Ссылка (fce).xml'), 'Path "test/test/Ссылка (fce).xml" should be valid'); + } + + public function testIsFileIgnored() + { + $filesCommand = $this->gitCommands->command('files'); + $this->addFile('ignoretest',null,'Git should Ignore'); + $this->addFile('.gitignore',null,'ignoretest'); + + $this->assertTrue($filesCommand->isFileIgnored('ignoretest'),'File ignoretest should be ignored'); + + $this->updateFile('.gitignore',null,'test'); + $this->assertFalse($filesCommand->isFileIgnored('test'),'File test is not ignored because it is commited already'); + + $this->assertFalse($filesCommand->isFileIgnored('notest'),'File does not exist'); + + $this->assertFalse($filesCommand->isFileIgnored('MoreFiles/test2'),'File exists and should not be ignored'); + } + + public function testIsFileTracked() + { + $filesCommand = $this->gitCommands->command('files'); + $this->addFile('ignoretest',null,'Git should Ignore'); + $this->addFile('.gitignore',null,'ignoretest'); + + $this->assertFalse($filesCommand->isFileTracked('ignoretest'),'File ignoretest should be ignored'); + + $this->updateFile('.gitignore',null,'test'); + $this->assertTrue($filesCommand->isFileTracked('test'),'File test is not ignored because it is commited already'); + + $this->assertFalse($filesCommand->isFileTracked('notest'),'File does not exist'); + + $this->assertTrue($filesCommand->isFileTracked('MoreFiles/test2'),'File exists and should not be ignored'); + } + + public function testIgnoreFile() + { + $filesCommand = $this->gitCommands->command('files'); + $this->addFile('ignoretest',null,'Git should Ignore'); + + $response = $filesCommand->ignoreFile('ignoretest'); + + $this->assertEquals('File added to .gitignore',$response); + + $message = ''; + try{ + $filesCommand->ignoreFile('test'); + }catch(\VersionControl\GitCommandBundle\GitCommands\Exception\FileStatusException $e){ + $message = $e->getMessage(); + } + + $this->assertEquals('File path is been tracked. Please untrack file first',$message); + + try{ + $filesCommand->ignoreFile('testFileDoesNotExist'); + }catch(\VersionControl\GitCommandBundle\GitCommands\Exception\InvalidFilePathException $e){ + $message = $e->getMessage(); + } + + $this->assertEquals('File path was not valid. Please check that the file exists.',$message); + } + + + public function testUnTrackFile() + { + $filesCommand = $this->gitCommands->command('files'); + + //$this->assertTrue($filesCommand->isFileTracked('test'),'Test that test file is tracked'); + + //Some files are not commits so an exception will be thrown + $message = ''; + try{ + $filesCommand->unTrackFile('test'); + }catch(\VersionControl\GitCommandBundle\GitCommands\Exception\FileStatusException $e){ + $message = $e->getMessage(); + } + $this->assertEquals('Please commit all files first',$message); + + //Commit all files + $this->gitCommands->command('commit')->stageAll(); + $this->gitCommands->command('commit')->commit('second commit', 'Paul Schweppe '); + + //Untrack file should now work + $response2 = $filesCommand->unTrackFile('test'); + $this->assertContains('Please commit to complete the removal',$response2); + + //Add test to .gitignore + $this->updateFile('.gitignore',null,'test'); + + //Commit change to untracked file + //$this->command->runCommand('git add .'); + //$this->gitCommands->command('commit')->stageAll(); + //$this->gitCommands->command('commit')->commit('Remove file from git index', 'Paul Schweppe '); + + //Test that file is no longer tracked + $this->assertFalse($filesCommand->isFileTracked('test'),'Test that test file is no longer tracked'); + + + + + } + + } From 080c7cb18abfdd7d7815267a91b1fa38d1626041 Mon Sep 17 00:00:00 2001 From: Paul Schweppe Date: Mon, 22 May 2017 13:04:06 +0100 Subject: [PATCH 40/60] Add more unit test --- .../Command/GitFilesCommandTest.php | 49 ++++++++++++------- 1 file changed, 30 insertions(+), 19 deletions(-) diff --git a/src/VersionControl/GitCommandBundle/Tests/GitCommands/Command/GitFilesCommandTest.php b/src/VersionControl/GitCommandBundle/Tests/GitCommands/Command/GitFilesCommandTest.php index 38da270..e9950b8 100644 --- a/src/VersionControl/GitCommandBundle/Tests/GitCommands/Command/GitFilesCommandTest.php +++ b/src/VersionControl/GitCommandBundle/Tests/GitCommands/Command/GitFilesCommandTest.php @@ -174,44 +174,55 @@ public function testIgnoreFile() $this->assertEquals('File path was not valid. Please check that the file exists.',$message); } + /** + * @expectedException \VersionControl\GitCommandBundle\GitCommands\Exception\FileStatusException + */ + public function testUnTrackFileExceptionFromRepoNotCommitted() + { + // make your exception assertions + //$this->expectException(\VersionControl\GitCommandBundle\GitCommands\Exception\FileStatusException::class); + //$this->expectExceptionMessage('Please commit all files first'); + + $filesCommand = $this->gitCommands->command('files'); + $filesCommand->unTrackFile('test'); + + } public function testUnTrackFile() { $filesCommand = $this->gitCommands->command('files'); - //$this->assertTrue($filesCommand->isFileTracked('test'),'Test that test file is tracked'); + //Commit all files + $this->gitCommands->command('commit')->stageAll(); + $this->gitCommands->command('commit')->commit('second commit', 'Paul Schweppe '); - //Some files are not commits so an exception will be thrown - $message = ''; - try{ - $filesCommand->unTrackFile('test'); - }catch(\VersionControl\GitCommandBundle\GitCommands\Exception\FileStatusException $e){ - $message = $e->getMessage(); - } - $this->assertEquals('Please commit all files first',$message); + //Untrack file should now work + $response = $filesCommand->unTrackFile('test'); + $this->assertContains('Please commit to complete the removal',$response); + + } + + public function testFileNolongerTrackAfterUntrackFile() + { + $filesCommand = $this->gitCommands->command('files'); //Commit all files $this->gitCommands->command('commit')->stageAll(); $this->gitCommands->command('commit')->commit('second commit', 'Paul Schweppe '); //Untrack file should now work - $response2 = $filesCommand->unTrackFile('test'); - $this->assertContains('Please commit to complete the removal',$response2); + $filesCommand->unTrackFile('test'); - //Add test to .gitignore - $this->updateFile('.gitignore',null,'test'); + //Add test to .gitignore. Must happen before commit + $this->updateFile('.gitignore','test'); //Commit change to untracked file - //$this->command->runCommand('git add .'); - //$this->gitCommands->command('commit')->stageAll(); - //$this->gitCommands->command('commit')->commit('Remove file from git index', 'Paul Schweppe '); + $this->gitCommands->command('commit')->stageAll(); + $this->gitCommands->command('commit')->commit('Remove file from git index', 'Paul Schweppe '); //Test that file is no longer tracked $this->assertFalse($filesCommand->isFileTracked('test'),'Test that test file is no longer tracked'); - - - } From 641c66948004230b5290ac84b5a71e0e80b454a7 Mon Sep 17 00:00:00 2001 From: Paul Schweppe Date: Wed, 24 May 2017 18:03:28 +0100 Subject: [PATCH 41/60] Use openssl instead of mcrypt for encrypting and decryption --- .../Encryptors/AES256Encryptor.php | 26 +++++++++++++++++-- .../Encryptors/AES256Encryptor.php | 26 +++++++++++++++++-- 2 files changed, 48 insertions(+), 4 deletions(-) diff --git a/src/VersionControl/DoctrineEncryptBundle/Encryptors/AES256Encryptor.php b/src/VersionControl/DoctrineEncryptBundle/Encryptors/AES256Encryptor.php index 3b7227e..5f822ba 100644 --- a/src/VersionControl/DoctrineEncryptBundle/Encryptors/AES256Encryptor.php +++ b/src/VersionControl/DoctrineEncryptBundle/Encryptors/AES256Encryptor.php @@ -35,9 +35,20 @@ public function __construct($key) */ public function encrypt($data) { - return trim(base64_encode(mcrypt_encrypt( + if (defined('PHP_MAJOR_VERSION') && PHP_MAJOR_VERSION >= 7) { + $iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length("AES_256_ECB")); + + return trim(base64_encode(openssl_encrypt ( + $data , + "AES-256-ECB", + $this->secretKey, + 0, + $iv))); + }else{ + return trim(base64_encode(mcrypt_encrypt( MCRYPT_RIJNDAEL_256, $this->secretKey, $data, MCRYPT_MODE_ECB, mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND )))); + } } /** @@ -49,11 +60,22 @@ public function encrypt($data) */ public function decrypt($data) { - return trim(mcrypt_decrypt( + if (defined('PHP_MAJOR_VERSION') && PHP_MAJOR_VERSION >= 7) { + $iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length("AES_256_ECB")); + + return trim(openssl_decrypt ( + base64_decode($data) , + "AES-256-ECB", + $this->secretKey, + 0, + $iv)); + }else{ + return trim(mcrypt_decrypt( MCRYPT_RIJNDAEL_256, $this->secretKey, base64_decode($data), MCRYPT_MODE_ECB, mcrypt_create_iv( mcrypt_get_iv_size( MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB ), MCRYPT_RAND ))); + } } } diff --git a/src/VersionControl/GitControlBundle/Encryptors/AES256Encryptor.php b/src/VersionControl/GitControlBundle/Encryptors/AES256Encryptor.php index 09ee86b..36fc826 100644 --- a/src/VersionControl/GitControlBundle/Encryptors/AES256Encryptor.php +++ b/src/VersionControl/GitControlBundle/Encryptors/AES256Encryptor.php @@ -42,9 +42,20 @@ public function encrypt($data) return $data; } - return trim(base64_encode(mcrypt_encrypt( + if (defined('PHP_MAJOR_VERSION') && PHP_MAJOR_VERSION >= 7) { + $iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length("AES_256_ECB")); + + return trim(base64_encode(openssl_encrypt ( + $data , + "AES-256-ECB", + $this->secretKey, + 0, + $iv))); + }else{ + return trim(base64_encode(mcrypt_encrypt( MCRYPT_RIJNDAEL_256, $this->secretKey, $data, MCRYPT_MODE_ECB, mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND )))); + } } /** @@ -60,11 +71,22 @@ public function decrypt($data) return $data; } - return trim(mcrypt_decrypt( + if (defined('PHP_MAJOR_VERSION') && PHP_MAJOR_VERSION >= 7) { + $iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length("AES_256_ECB")); + + return trim(openssl_decrypt ( + base64_decode($data) , + "AES-256-ECB", + $this->secretKey, + 0, + $iv)); + }else{ + return trim(mcrypt_decrypt( MCRYPT_RIJNDAEL_256, $this->secretKey, base64_decode($data), MCRYPT_MODE_ECB, mcrypt_create_iv( mcrypt_get_iv_size( MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB ), MCRYPT_RAND ))); + } } } From b1ef8388f812c4f5a26db8c76b3e264504168a49 Mon Sep 17 00:00:00 2001 From: Paul Schweppe Date: Wed, 24 May 2017 18:06:49 +0100 Subject: [PATCH 42/60] Show edit button for project only if master of project --- .../GitControlBundle/Resources/views/Default/list.html.twig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/VersionControl/GitControlBundle/Resources/views/Default/list.html.twig b/src/VersionControl/GitControlBundle/Resources/views/Default/list.html.twig index a957d8a..a9f2edd 100644 --- a/src/VersionControl/GitControlBundle/Resources/views/Default/list.html.twig +++ b/src/VersionControl/GitControlBundle/Resources/views/Default/list.html.twig @@ -59,7 +59,9 @@ {{userProject.roles}} Open - Edit + {% if (is_granted('MASTER', userProject.project)) %} + Edit + {% endif %} {% endfor %} From a4a6dc177b7dacbce41fe034d5ce92f4b30d56d2 Mon Sep 17 00:00:00 2001 From: Paul Schweppe Date: Wed, 24 May 2017 18:26:33 +0100 Subject: [PATCH 43/60] Fixed misspelling of cipher and show readme files when file set to readme else show last md file --- .../DoctrineEncryptBundle/Encryptors/AES256Encryptor.php | 4 ++-- .../GitCommandBundle/GitCommands/GitCommand.php | 2 +- .../Controller/ProjectFilesController.php | 9 +++++++-- .../GitControlBundle/Encryptors/AES256Encryptor.php | 4 ++-- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/VersionControl/DoctrineEncryptBundle/Encryptors/AES256Encryptor.php b/src/VersionControl/DoctrineEncryptBundle/Encryptors/AES256Encryptor.php index 5f822ba..cde07b2 100644 --- a/src/VersionControl/DoctrineEncryptBundle/Encryptors/AES256Encryptor.php +++ b/src/VersionControl/DoctrineEncryptBundle/Encryptors/AES256Encryptor.php @@ -36,7 +36,7 @@ public function __construct($key) public function encrypt($data) { if (defined('PHP_MAJOR_VERSION') && PHP_MAJOR_VERSION >= 7) { - $iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length("AES_256_ECB")); + $iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length("AES-256-ECB")); return trim(base64_encode(openssl_encrypt ( $data , @@ -61,7 +61,7 @@ public function encrypt($data) public function decrypt($data) { if (defined('PHP_MAJOR_VERSION') && PHP_MAJOR_VERSION >= 7) { - $iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length("AES_256_ECB")); + $iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length("AES-256-ECB")); return trim(openssl_decrypt ( base64_decode($data) , diff --git a/src/VersionControl/GitCommandBundle/GitCommands/GitCommand.php b/src/VersionControl/GitCommandBundle/GitCommands/GitCommand.php index 6a746df..eff872e 100644 --- a/src/VersionControl/GitCommandBundle/GitCommands/GitCommand.php +++ b/src/VersionControl/GitCommandBundle/GitCommands/GitCommand.php @@ -219,7 +219,7 @@ public function getGitPath() */ protected function setGitPath($gitPath) { - $this->gitPath = rtrim(trim($gitPath), '/'); + $this->gitPath = rtrim(trim($gitPath), DIRECTORY_SEPARATOR ); return $this; } diff --git a/src/VersionControl/GitControlBundle/Controller/ProjectFilesController.php b/src/VersionControl/GitControlBundle/Controller/ProjectFilesController.php index 6cdcbe6..2d1179e 100644 --- a/src/VersionControl/GitControlBundle/Controller/ProjectFilesController.php +++ b/src/VersionControl/GitControlBundle/Controller/ProjectFilesController.php @@ -49,8 +49,13 @@ public function fileListAction($id, $currentDir = '') $readme = ''; foreach ($files as $file) { if (strtolower($file->getExtension()) == 'md' || strtolower($file->getExtension()) == 'markdown') { - $readme = $this->gitFilesCommands->readFile($file); - break; + if(strtolower($file->getFilename()) === 'readme' ){ + $readme = $this->gitFilesCommands->readFile($file); + break; + }else{ + //Get last md file + $readme = $this->gitFilesCommands->readFile($file); + } } } diff --git a/src/VersionControl/GitControlBundle/Encryptors/AES256Encryptor.php b/src/VersionControl/GitControlBundle/Encryptors/AES256Encryptor.php index 36fc826..f8542b8 100644 --- a/src/VersionControl/GitControlBundle/Encryptors/AES256Encryptor.php +++ b/src/VersionControl/GitControlBundle/Encryptors/AES256Encryptor.php @@ -43,7 +43,7 @@ public function encrypt($data) } if (defined('PHP_MAJOR_VERSION') && PHP_MAJOR_VERSION >= 7) { - $iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length("AES_256_ECB")); + $iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length("AES-256-ECB")); return trim(base64_encode(openssl_encrypt ( $data , @@ -72,7 +72,7 @@ public function decrypt($data) } if (defined('PHP_MAJOR_VERSION') && PHP_MAJOR_VERSION >= 7) { - $iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length("AES_256_ECB")); + $iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length("AES-256-ECB")); return trim(openssl_decrypt ( base64_decode($data) , From 8d7722d274c8562964b38d64eac49c13cb3dea1c Mon Sep 17 00:00:00 2001 From: Paul Schweppe Date: Wed, 24 May 2017 22:10:06 +0100 Subject: [PATCH 44/60] Updated fos user bundles templates --- .../ChangePassword/changePassword.html.twig | 5 --- .../ChangePassword/change_password.html.twig | 17 ++++++++++ ...twig => change_password_content.html.twig} | 8 ++++- .../views/Profile/edit.html.twig | 13 +++++++- .../views/Profile/edit_content.html.twig | 9 +++++- .../views/Profile/show.html.twig | 32 ++++++++++++++++++- .../Controller/UserManagementController.php | 2 +- .../Resources/views/admin.layout.html.twig | 2 +- .../Resources/views/layout.html.twig | 2 +- 9 files changed, 78 insertions(+), 12 deletions(-) delete mode 100755 app/Resources/FOSUserBundle/views/ChangePassword/changePassword.html.twig create mode 100644 app/Resources/FOSUserBundle/views/ChangePassword/change_password.html.twig rename app/Resources/FOSUserBundle/views/ChangePassword/{changePassword_content.html.twig => change_password_content.html.twig} (54%) mode change 100755 => 100644 diff --git a/app/Resources/FOSUserBundle/views/ChangePassword/changePassword.html.twig b/app/Resources/FOSUserBundle/views/ChangePassword/changePassword.html.twig deleted file mode 100755 index eb95bf1..0000000 --- a/app/Resources/FOSUserBundle/views/ChangePassword/changePassword.html.twig +++ /dev/null @@ -1,5 +0,0 @@ -{% extends "FOSUserBundle::layout.html.twig" %} - -{% block fos_user_content %} -{% include "FOSUserBundle:ChangePassword:changePassword_content.html.twig" %} -{% endblock fos_user_content %} diff --git a/app/Resources/FOSUserBundle/views/ChangePassword/change_password.html.twig b/app/Resources/FOSUserBundle/views/ChangePassword/change_password.html.twig new file mode 100644 index 0000000..3cb778f --- /dev/null +++ b/app/Resources/FOSUserBundle/views/ChangePassword/change_password.html.twig @@ -0,0 +1,17 @@ +{% extends "FOSUserBundle::layout.html.twig" %} + +{% block fos_user_content %} + + +{% endblock fos_user_content %} diff --git a/app/Resources/FOSUserBundle/views/ChangePassword/changePassword_content.html.twig b/app/Resources/FOSUserBundle/views/ChangePassword/change_password_content.html.twig old mode 100755 new mode 100644 similarity index 54% rename from app/Resources/FOSUserBundle/views/ChangePassword/changePassword_content.html.twig rename to app/Resources/FOSUserBundle/views/ChangePassword/change_password_content.html.twig index 55b229a..7d2f1bf --- a/app/Resources/FOSUserBundle/views/ChangePassword/changePassword_content.html.twig +++ b/app/Resources/FOSUserBundle/views/ChangePassword/change_password_content.html.twig @@ -3,6 +3,12 @@
{{ form_widget(form) }}
- +
+
+
+
+ Cancel +
+
diff --git a/app/Resources/FOSUserBundle/views/Profile/edit.html.twig b/app/Resources/FOSUserBundle/views/Profile/edit.html.twig index f6f6c0a..362a389 100755 --- a/app/Resources/FOSUserBundle/views/Profile/edit.html.twig +++ b/app/Resources/FOSUserBundle/views/Profile/edit.html.twig @@ -1,5 +1,16 @@ {% extends "FOSUserBundle::layout.html.twig" %} {% block fos_user_content %} -{% include "FOSUserBundle:Profile:edit_content.html.twig" %} + {% endblock fos_user_content %} diff --git a/app/Resources/FOSUserBundle/views/Profile/edit_content.html.twig b/app/Resources/FOSUserBundle/views/Profile/edit_content.html.twig index be9fd32..20334fe 100755 --- a/app/Resources/FOSUserBundle/views/Profile/edit_content.html.twig +++ b/app/Resources/FOSUserBundle/views/Profile/edit_content.html.twig @@ -3,6 +3,13 @@ + +
+
+
+ Cancel +
+
diff --git a/app/Resources/FOSUserBundle/views/Profile/show.html.twig b/app/Resources/FOSUserBundle/views/Profile/show.html.twig index 6c41a65..a2b4340 100755 --- a/app/Resources/FOSUserBundle/views/Profile/show.html.twig +++ b/app/Resources/FOSUserBundle/views/Profile/show.html.twig @@ -1,5 +1,35 @@ {% extends "FOSUserBundle::layout.html.twig" %} {% block fos_user_content %} -{% include "FOSUserBundle:Profile:show_content.html.twig" %} + + {% endblock fos_user_content %} diff --git a/src/VersionControl/GitControlBundle/Controller/UserManagementController.php b/src/VersionControl/GitControlBundle/Controller/UserManagementController.php index d9083a0..fbda5ec 100644 --- a/src/VersionControl/GitControlBundle/Controller/UserManagementController.php +++ b/src/VersionControl/GitControlBundle/Controller/UserManagementController.php @@ -46,7 +46,7 @@ public function listAction() } /** - * Creates a new Project entity. + * Creates a new user entity. * * @Route("/", name="usermanagement_create") * @Method("POST") diff --git a/src/VersionControl/GitControlBundle/Resources/views/admin.layout.html.twig b/src/VersionControl/GitControlBundle/Resources/views/admin.layout.html.twig index 2136a8f..fc4a657 100644 --- a/src/VersionControl/GitControlBundle/Resources/views/admin.layout.html.twig +++ b/src/VersionControl/GitControlBundle/Resources/views/admin.layout.html.twig @@ -142,7 +142,7 @@