From ee32248f43baef7e995c9e420cd00a137e626cf0 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Sat, 8 Oct 2016 00:02:22 +0200 Subject: Ensure access_token are removed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When we remove the client, we should ensure that access_token are also removed. To ensure that, I created a test that generated an access_token. So when we remove the client, this association should be cascaded and shouldn’t generate an error. Also I moved some Api related stuff to the ApiBundle (like the developer controler and ClientType form) --- src/Wallabag/ApiBundle/Form/Type/ClientType.php | 46 +++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 src/Wallabag/ApiBundle/Form/Type/ClientType.php (limited to 'src/Wallabag/ApiBundle/Form') diff --git a/src/Wallabag/ApiBundle/Form/Type/ClientType.php b/src/Wallabag/ApiBundle/Form/Type/ClientType.php new file mode 100644 index 00000000..0ea1a9c5 --- /dev/null +++ b/src/Wallabag/ApiBundle/Form/Type/ClientType.php @@ -0,0 +1,46 @@ +add('name', TextType::class, ['label' => 'developer.client.form.name_label']) + ->add('redirect_uris', UrlType::class, ['required' => false, 'label' => 'developer.client.form.redirect_uris_label']) + ->add('save', SubmitType::class, ['label' => 'developer.client.form.save_label']) + ; + + $builder->get('redirect_uris') + ->addModelTransformer(new CallbackTransformer( + function ($originalUri) { + return $originalUri; + }, + function ($submittedUri) { + return [$submittedUri]; + } + )) + ; + } + + public function configureOptions(OptionsResolver $resolver) + { + $resolver->setDefaults([ + 'data_class' => 'Wallabag\ApiBundle\Entity\Client', + ]); + } + + public function getBlockPrefix() + { + return 'client'; + } +} -- cgit v1.2.3