3 Commits

Author SHA1 Message Date
tim
dacf3d6687 Allow symfony 6 2022-01-30 01:15:39 +01:00
tim
cd3c5a0a52 Allow for bool type as config type 2022-01-30 01:11:39 +01:00
da8a1e37ca Fix line endings? 2021-07-21 00:25:37 +02:00
7 changed files with 766 additions and 763 deletions

View File

@ -60,10 +60,8 @@ abstract class BaseController extends AbstractController
switch ($type) {
case CheckboxType::class:
return boolval($value);
break;
default:
return $value;
break;
}
}

View File

@ -11,6 +11,7 @@ class Configuration implements ConfigurationInterface
{
public const TYPE_TEXT = 'text';
public const TYPE_NUMBER = 'number';
public const TYPE_BOOL = 'bool';
public function getConfigTreeBuilder()
{
@ -24,7 +25,7 @@ class Configuration implements ConfigurationInterface
->children()
->scalarNode('name')->end()
->enumNode('type')
->values([self::TYPE_TEXT, self::TYPE_NUMBER])
->values([self::TYPE_TEXT, self::TYPE_NUMBER, self::TYPE_BOOL])
->defaultValue(self::TYPE_TEXT)
->end()
->end()

View File

@ -6,6 +6,7 @@ use Ardent\ParameterBundle\DependencyInjection\Configuration;
use Ardent\ParameterBundle\Entity\Parameter;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\NumberType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
@ -101,6 +102,9 @@ class ParameterService
case Configuration::TYPE_NUMBER:
$class = NumberType::class;
break;
case Configuration::TYPE_BOOL:
$class = CheckboxType::class;
break;
}
// Add the group name in front of the parameter name

View File

@ -3,9 +3,9 @@
"description": "Simple bundle for storing parameters in a database",
"type": "symfony-bundle",
"require": {
"doctrine/orm": "^2.7",
"symfony/form": "^5.0",
"symfony/twig-bundle": "^5.0"
"doctrine/orm": "^2.0",
"symfony/form": "^5.0|^6.0",
"symfony/twig-bundle": "^5.0|^6.0"
},
"autoload": {
"psr-4": {