mirror of
https://github.com/wallabag/wallabag.git
synced 2025-07-22 17:18:37 +00:00
Update to Symfony 2.7
And fix some deps instead of using dev tags
This commit is contained in:
parent
170746f99d
commit
75e9d1df03
9 changed files with 80 additions and 135 deletions
|
@ -4,7 +4,7 @@ namespace Wallabag\CoreBundle\Form\Type;
|
|||
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class ConfigType extends AbstractType
|
||||
{
|
||||
|
@ -24,14 +24,17 @@ class ConfigType extends AbstractType
|
|||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
$builder
|
||||
->add('theme', 'choice', array('choices' => $this->themes))
|
||||
->add('theme', 'choice', array(
|
||||
'choices' => array_flip($this->themes),
|
||||
'choices_as_values' => true,
|
||||
))
|
||||
->add('items_per_page')
|
||||
->add('language')
|
||||
->add('save', 'submit')
|
||||
;
|
||||
}
|
||||
|
||||
public function setDefaultOptions(OptionsResolverInterface $resolver)
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setDefaults(array(
|
||||
'data_class' => 'Wallabag\CoreBundle\Entity\Config',
|
||||
|
|
|
@ -4,7 +4,7 @@ namespace Wallabag\CoreBundle\Form\Type;
|
|||
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class EntryType extends AbstractType
|
||||
{
|
||||
|
@ -16,7 +16,7 @@ class EntryType extends AbstractType
|
|||
;
|
||||
}
|
||||
|
||||
public function setDefaultOptions(OptionsResolverInterface $resolver)
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setDefaults(array(
|
||||
'data_class' => 'Wallabag\CoreBundle\Entity\Entry',
|
||||
|
|
|
@ -4,7 +4,7 @@ namespace Wallabag\CoreBundle\Form\Type;
|
|||
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Symfony\Component\Validator\Constraints;
|
||||
|
||||
class NewUserType extends AbstractType
|
||||
|
@ -27,7 +27,7 @@ class NewUserType extends AbstractType
|
|||
;
|
||||
}
|
||||
|
||||
public function setDefaultOptions(OptionsResolverInterface $resolver)
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setDefaults(array(
|
||||
'data_class' => 'Wallabag\CoreBundle\Entity\User',
|
||||
|
|
|
@ -4,7 +4,7 @@ namespace Wallabag\CoreBundle\Form\Type;
|
|||
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class RssType extends AbstractType
|
||||
{
|
||||
|
@ -16,7 +16,7 @@ class RssType extends AbstractType
|
|||
;
|
||||
}
|
||||
|
||||
public function setDefaultOptions(OptionsResolverInterface $resolver)
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setDefaults(array(
|
||||
'data_class' => 'Wallabag\CoreBundle\Entity\Config',
|
||||
|
|
|
@ -4,7 +4,7 @@ namespace Wallabag\CoreBundle\Form\Type;
|
|||
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class UserInformationType extends AbstractType
|
||||
{
|
||||
|
@ -17,7 +17,7 @@ class UserInformationType extends AbstractType
|
|||
;
|
||||
}
|
||||
|
||||
public function setDefaultOptions(OptionsResolverInterface $resolver)
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setDefaults(array(
|
||||
'data_class' => 'Wallabag\CoreBundle\Entity\User',
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace Wallabag\CoreBundle\Security\Validator;
|
||||
|
||||
use Symfony\Component\Security\Core\User\UserInterface;
|
||||
use Symfony\Component\Security\Core\SecurityContextInterface;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
||||
use Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface;
|
||||
use Symfony\Component\Validator\Constraint;
|
||||
use Symfony\Component\Validator\ConstraintValidator;
|
||||
|
@ -11,14 +11,17 @@ use Symfony\Component\Validator\Exception\ConstraintDefinitionException;
|
|||
use Symfony\Component\Validator\Exception\UnexpectedTypeException;
|
||||
use Symfony\Component\Security\Core\Validator\Constraints\UserPassword;
|
||||
|
||||
/**
|
||||
* @see Symfony\Component\Security\Core\Validator\Constraints\UserPasswordValidator
|
||||
*/
|
||||
class WallabagUserPasswordValidator extends ConstraintValidator
|
||||
{
|
||||
private $securityContext;
|
||||
private $encoderFactory;
|
||||
|
||||
public function __construct(SecurityContextInterface $securityContext, EncoderFactoryInterface $encoderFactory)
|
||||
public function __construct(TokenStorageInterface $tokenStorage, EncoderFactoryInterface $encoderFactory)
|
||||
{
|
||||
$this->securityContext = $securityContext;
|
||||
$this->tokenStorage = $tokenStorage;
|
||||
$this->encoderFactory = $encoderFactory;
|
||||
}
|
||||
|
||||
|
@ -31,7 +34,7 @@ class WallabagUserPasswordValidator extends ConstraintValidator
|
|||
throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\UserPassword');
|
||||
}
|
||||
|
||||
$user = $this->securityContext->getToken()->getUser();
|
||||
$user = $this->tokenStorage->getToken()->getUser();
|
||||
|
||||
if (!$user instanceof UserInterface) {
|
||||
throw new ConstraintDefinitionException('The User object must implement the UserInterface interface.');
|
||||
|
|
|
@ -44,7 +44,7 @@ class ConfigControllerTest extends WallabagCoreTestCase
|
|||
$form = $crawler->filter('button[id=config_save]')->form();
|
||||
|
||||
$data = array(
|
||||
'config[theme]' => 'baggy',
|
||||
'config[theme]' => 0,
|
||||
'config[items_per_page]' => '30',
|
||||
'config[language]' => 'fr_FR',
|
||||
);
|
||||
|
@ -63,12 +63,12 @@ class ConfigControllerTest extends WallabagCoreTestCase
|
|||
{
|
||||
return array(
|
||||
array(array(
|
||||
'config[theme]' => 'baggy',
|
||||
'config[theme]' => 0,
|
||||
'config[items_per_page]' => '',
|
||||
'config[language]' => 'fr_FR',
|
||||
)),
|
||||
array(array(
|
||||
'config[theme]' => 'baggy',
|
||||
'config[theme]' => 0,
|
||||
'config[items_per_page]' => '12',
|
||||
'config[language]' => '',
|
||||
)),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue