瀏覽代碼

Merge branch 'develop'

develop
Fabien Normand 3 年之前
父節點
當前提交
6132633041
共有 4 個檔案被更改,包括 34 行新增3 行删除
  1. +15
    -3
      Form/Setting/BaseSettingType.php
  2. +7
    -0
      Repository/Ticket/TicketRepositoryQuery.php
  3. +11
    -0
      Repository/Ticket/TicketStore.php
  4. +1
    -0
      Resources/views/admin/setting/form.html.twig

+ 15
- 3
Form/Setting/BaseSettingType.php 查看文件

@@ -5,6 +5,7 @@ namespace Lc\SovBundle\Form\Setting;
use FOS\CKEditorBundle\Form\Type\CKEditorType;
use Lc\SovBundle\Definition\SiteSettingDefinitionInterface;
use Lc\SovBundle\Form\Common\FileManagerType;
use Lc\SovBundle\Translation\TranslatorAdmin;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\DateType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
@@ -17,13 +18,16 @@ abstract class BaseSettingType extends AbstractType
{
protected EntityManagerInterface $em;
protected SiteSettingDefinitionInterface $settingDefinition;
protected TranslatorAdmin $translatorAdmin;

public function __construct(
EntityManagerInterface $entityManager,
SiteSettingDefinitionInterface $settingDefinition
SiteSettingDefinitionInterface $settingDefinition,
TranslatorAdmin $translatorAdmin
) {
$this->em = $entityManager;
$this->settingDefinition = $settingDefinition;
$this->translatorAdmin = $translatorAdmin;
}

public function buildFormSetting($label, $form, $settingDefinition, $settingEntity)
@@ -37,7 +41,8 @@ abstract class BaseSettingType extends AbstractType
'text',
TextType::class,
[
'label' => $label
'label' => $label,
'translation_domain' => 'admin',
]
);
} elseif ($settingType == 'textarea') {
@@ -45,7 +50,8 @@ abstract class BaseSettingType extends AbstractType
'text',
TextareaType::class,
[
'label' => $label
'label' => $label,
'translation_domain' => 'admin',
]
);
} elseif ($settingType == 'textarea_advanced') {
@@ -54,6 +60,7 @@ abstract class BaseSettingType extends AbstractType
CKEditorType::class,
[
'label' => $label,
'translation_domain' => 'admin',
'attr' => [
'class' => 'field-text_editor'
]
@@ -65,6 +72,7 @@ abstract class BaseSettingType extends AbstractType
ChoiceType::class,
[
'label' => $label,
'translation_domain' => 'admin',
'expanded' => false,
'multiple' => false,
'placeholder' => false,
@@ -77,6 +85,7 @@ abstract class BaseSettingType extends AbstractType
ChoiceType::class,
[
'label' => $label,
'translation_domain' => 'admin',
'expanded' => true,
'multiple' => false,
'placeholder' => false,
@@ -89,6 +98,7 @@ abstract class BaseSettingType extends AbstractType
DateType::class,
[
'label' => $label,
'translation_domain' => 'admin',
'widget' => 'single_text',
]
);
@@ -98,6 +108,7 @@ abstract class BaseSettingType extends AbstractType
TimeType::class,
[
'label' => $label,
'translation_domain' => 'admin',
'input' => 'datetime',
'widget' => 'single_text',
]
@@ -108,6 +119,7 @@ abstract class BaseSettingType extends AbstractType
FileManagerType::class,
[
'label' => $label,
'translation_domain' => 'admin',
'attr' => [
'type' => $settingType
]

+ 7
- 0
Repository/Ticket/TicketRepositoryQuery.php 查看文件

@@ -73,4 +73,11 @@ class TicketRepositoryQuery extends AbstractRepositoryQuery implements TicketRep
return $this
->select('count(ticket.id) as count');
}

public function filterByVisitorToken(string $visitorToken): self
{
return $this
->andWhere('.visitorToken LIKE :visitorToken')
->setParameter('visitorToken', $visitorToken);
}
}

+ 11
- 0
Repository/Ticket/TicketStore.php 查看文件

@@ -66,4 +66,15 @@ class TicketStore extends AbstractStore implements TicketStoreInterface

return $query->count();
}

public function getOneByIdAndVisitorToken(int $id, string $token, $query = null)
{
$query = $this->createDefaultQuery($query);

$query
->filterById($id)
->filterByVisitorToken($token);

return $query->findOne();
}
}

+ 1
- 0
Resources/views/admin/setting/form.html.twig 查看文件

@@ -11,6 +11,7 @@
{# content #}
{% block content %}
{% form_theme form '@LcSov/adminlte/crud/form_theme.html.twig' %}
{% trans_default_domain 'admin' %}
{{ form_start(form) }}

{# panes #}

Loading…
取消
儲存