code cleanup

This commit is contained in:
Kevin Papst
2018-01-13 00:20:41 +01:00
parent fc9ce52d69
commit d5e689e307
8 changed files with 14 additions and 74 deletions

View File

@@ -95,8 +95,8 @@ services:
# FORMS # FORMS
# ================================================================================ # ================================================================================
# form to edit user roles # form type to edit user roles
app.admin.user_role: App\Form\Type\UserRoleType:
class: App\Form\Type\UserRoleType class: App\Form\Type\UserRoleType
arguments: ["%security.role_hierarchy.roles%"] arguments: ["%security.role_hierarchy.roles%"]
tags: tags:

View File

@@ -59,7 +59,6 @@ class AppFixtures extends Fixture
->setPassword($passwordEncoder->encodePassword($claraCustomer, self::DEFAULT_PASSWORD)) ->setPassword($passwordEncoder->encodePassword($claraCustomer, self::DEFAULT_PASSWORD))
; ;
$manager->persist($claraCustomer); $manager->persist($claraCustomer);
var_dump($passwordEncoder->encodePassword($claraCustomer, self::DEFAULT_PASSWORD));
$johnUser = new User(); $johnUser = new User();
$johnUser $johnUser

View File

@@ -1,66 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace App\Form\Type;
use App\Utils\MomentFormatConverter;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\DateTimeType;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormView;
use Symfony\Component\OptionsResolver\OptionsResolver;
/**
* Defines the custom form field type used to manipulate datetime values across
* Bootstrap Date\Time Picker javascript plugin.
* See http://symfony.com/doc/current/cookbook/form/create_custom_field_type.html
*
* @author Yonel Ceruto <yonelceruto@gmail.com>
*/
class DateTimePickerType extends AbstractType
{
/**
* @var MomentFormatConverter
*/
private $formatConverter;
public function __construct()
{
$this->formatConverter = new MomentFormatConverter();
}
/**
* {@inheritdoc}
*/
public function buildView(FormView $view, FormInterface $form, array $options)
{
$view->vars['attr']['data-date-format'] = $this->formatConverter->convert($options['format']);
$view->vars['attr']['data-date-locale'] = \Locale::getDefault();
}
/**
* {@inheritdoc}
*/
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'widget' => 'single_text',
]);
}
/**
* {@inheritdoc}
*/
public function getParent()
{
return DateTimeType::class;
}
}

View File

@@ -31,7 +31,8 @@ class LanguageType extends AbstractType
{ {
$resolver->setDefaults([ $resolver->setDefaults([
'choices' => array( 'choices' => array(
Intl::getLocaleBundle()->getLocaleName('de', 'de') => 'de' Intl::getLocaleBundle()->getLocaleName('de', \Locale::getDefault()) => 'de',
Intl::getLocaleBundle()->getLocaleName('en', \Locale::getDefault()) => 'en',
) )
]); ]);
} }

View File

@@ -30,7 +30,7 @@ class UserType extends AbstractType
public function configureOptions(OptionsResolver $resolver) public function configureOptions(OptionsResolver $resolver)
{ {
$resolver->setDefaults([ $resolver->setDefaults([
'class' => 'Kimai:User', 'class' => User::class,
'choice_label' => function (User $user) { 'choice_label' => function (User $user) {
if (!empty($user->getAlias())) { if (!empty($user->getAlias())) {
return $user->getAlias() . ' (' . $user->getUsername() . ')'; return $user->getAlias() . ' (' . $user->getUsername() . ')';

View File

@@ -74,8 +74,6 @@ class CustomerRepository extends AbstractRepository
->andWhere('c.id = :customer') ->andWhere('c.id = :customer')
; ;
// dump($qb->getQuery()->getSQL());exit;
$result = $qb->getQuery()->execute(['customer' => $customer], Query::HYDRATE_ARRAY); $result = $qb->getQuery()->execute(['customer' => $customer], Query::HYDRATE_ARRAY);
$stats = new CustomerStatistic(); $stats = new CustomerStatistic();

View File

@@ -181,9 +181,13 @@
<source>label.duration</source> <source>label.duration</source>
<target>Dauer</target> <target>Dauer</target>
</trans-unit> </trans-unit>
<trans-unit id="label.user">
<source>label.user</source>
<target>Benutzer</target>
</trans-unit>
<trans-unit id="label.username"> <trans-unit id="label.username">
<source>label.username</source> <source>label.username</source>
<target>Benutzer</target> <target>Benutzername</target>
</trans-unit> </trans-unit>
<trans-unit id="label.description"> <trans-unit id="label.description">
<source>label.description</source> <source>label.description</source>

View File

@@ -183,6 +183,10 @@
<source>label.duration</source> <source>label.duration</source>
<target>Duration</target> <target>Duration</target>
</trans-unit> </trans-unit>
<trans-unit id="label.usern">
<source>label.user</source>
<target>User</target>
</trans-unit>
<trans-unit id="label.username"> <trans-unit id="label.username">
<source>label.username</source> <source>label.username</source>
<target>Username</target> <target>Username</target>