add 'Length' constraint in forms
This commit is contained in:
parent
d3f27d97ad
commit
c1eb277a6a
|
@ -3,6 +3,7 @@
|
||||||
### Added
|
### Added
|
||||||
* allow to define templates show before and after a murph collection item
|
* allow to define templates show before and after a murph collection item
|
||||||
* add global batch actions
|
* add global batch actions
|
||||||
|
* add constraint `Length` in forms
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
* fix regression on crud sorting
|
* fix regression on crud sorting
|
||||||
|
|
|
@ -46,99 +46,100 @@ class Configuration implements ConfigurationInterface
|
||||||
|
|
||||||
$treeBuilder->getRootNode()
|
$treeBuilder->getRootNode()
|
||||||
->children()
|
->children()
|
||||||
->arrayNode('site')
|
->arrayNode('site')
|
||||||
->children()
|
->children()
|
||||||
->scalarNode('name')
|
->scalarNode('name')
|
||||||
->defaultValue('Murph')
|
->defaultValue('Murph')
|
||||||
->isRequired()
|
->isRequired()
|
||||||
->end()
|
->end()
|
||||||
->scalarNode('logo')
|
->scalarNode('logo')
|
||||||
->defaultValue('build/images/core/logo.svg')
|
->defaultValue('build/images/core/logo.svg')
|
||||||
->isRequired()
|
->isRequired()
|
||||||
->end()
|
->end()
|
||||||
->arrayNode('controllers')
|
->arrayNode('controllers')
|
||||||
->prototype('array')
|
->prototype('array')
|
||||||
->children()
|
->children()
|
||||||
->scalarNode('name')
|
->scalarNode('name')
|
||||||
->cannotBeEmpty()
|
->cannotBeEmpty()
|
||||||
->end()
|
->end()
|
||||||
->scalarNode('action')
|
->scalarNode('action')
|
||||||
->cannotBeEmpty()
|
->cannotBeEmpty()
|
||||||
->end()
|
->end()
|
||||||
->end()
|
->end()
|
||||||
->end()
|
->end()
|
||||||
->end()
|
->end()
|
||||||
->arrayNode('security')
|
->arrayNode('security')
|
||||||
->children()
|
->children()
|
||||||
->arrayNode('roles')
|
->arrayNode('roles')
|
||||||
->prototype('array')
|
->prototype('array')
|
||||||
->children()
|
->children()
|
||||||
->scalarNode('name')
|
->scalarNode('name')
|
||||||
->cannotBeEmpty()
|
->cannotBeEmpty()
|
||||||
->end()
|
->end()
|
||||||
->scalarNode('role')
|
->scalarNode('role')
|
||||||
->cannotBeEmpty()
|
->cannotBeEmpty()
|
||||||
->end()
|
->end()
|
||||||
->end()
|
->end()
|
||||||
->end()
|
->end()
|
||||||
->end()
|
->end()
|
||||||
->end()
|
->end()
|
||||||
->end()
|
->end()
|
||||||
->arrayNode('pages')
|
->arrayNode('pages')
|
||||||
->prototype('array')
|
->prototype('array')
|
||||||
->children()
|
->children()
|
||||||
->scalarNode('name')
|
->scalarNode('name')
|
||||||
->isRequired()
|
->isRequired()
|
||||||
->cannotBeEmpty()
|
->cannotBeEmpty()
|
||||||
->end()
|
->end()
|
||||||
->arrayNode('templates')
|
->arrayNode('templates')
|
||||||
->prototype('array')
|
->prototype('array')
|
||||||
->children()
|
->children()
|
||||||
->scalarNode('name')
|
->scalarNode('name')
|
||||||
->cannotBeEmpty()
|
->cannotBeEmpty()
|
||||||
->end()
|
->end()
|
||||||
->scalarNode('file')
|
->scalarNode('file')
|
||||||
->cannotBeEmpty()
|
->cannotBeEmpty()
|
||||||
->end()
|
->end()
|
||||||
->end()
|
->end()
|
||||||
->end()
|
->end()
|
||||||
->end()
|
->end()
|
||||||
->end()
|
->end()
|
||||||
->end()
|
->end()
|
||||||
->end()
|
->end()
|
||||||
->end()
|
->end()
|
||||||
->end()
|
->end()
|
||||||
->arrayNode('editor_js')
|
->arrayNode('editor_js')
|
||||||
->children()
|
->children()
|
||||||
->arrayNode('blocks')
|
->arrayNode('blocks')
|
||||||
->scalarPrototype()
|
->scalarPrototype()
|
||||||
->end()
|
->end()
|
||||||
->end()
|
->end()
|
||||||
->end()
|
->end()
|
||||||
->end()
|
->end()
|
||||||
->arrayNode('file_manager')
|
->arrayNode('file_manager')
|
||||||
->children()
|
->children()
|
||||||
->arrayNode('mimes')
|
->arrayNode('mimes')
|
||||||
->scalarPrototype()
|
->scalarPrototype()
|
||||||
->end()
|
->end()
|
||||||
->defaultValue($defaultMimetypes)
|
->defaultValue($defaultMimetypes)
|
||||||
->end()
|
->end()
|
||||||
->scalarNode('path')
|
->scalarNode('path')
|
||||||
->defaultValue('%kernel.project_dir%/public/uploads')
|
->defaultValue('%kernel.project_dir%/public/uploads')
|
||||||
->cannotBeEmpty()
|
->cannotBeEmpty()
|
||||||
->end()
|
->end()
|
||||||
->scalarNode('path_uri')
|
->scalarNode('path_uri')
|
||||||
->defaultValue('/uploads')
|
->defaultValue('/uploads')
|
||||||
->cannotBeEmpty()
|
->cannotBeEmpty()
|
||||||
->end()
|
->end()
|
||||||
->arrayNode('path_locked')
|
->arrayNode('path_locked')
|
||||||
->scalarPrototype()
|
->scalarPrototype()
|
||||||
->end()
|
->end()
|
||||||
->defaultValue($defaultLocked)
|
->defaultValue($defaultLocked)
|
||||||
->end()
|
->end()
|
||||||
->end()
|
->end()
|
||||||
->end()
|
->end()
|
||||||
->end();
|
->end()
|
||||||
|
;
|
||||||
|
|
||||||
return $treeBuilder;
|
return $treeBuilder;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ use Symfony\Component\Form\AbstractType;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
|
use Symfony\Component\Validator\Constraints\Length;
|
||||||
use Symfony\Component\Validator\Constraints\NotBlank;
|
use Symfony\Component\Validator\Constraints\NotBlank;
|
||||||
|
|
||||||
class MenuType extends AbstractType
|
class MenuType extends AbstractType
|
||||||
|
@ -23,6 +24,7 @@ class MenuType extends AbstractType
|
||||||
],
|
],
|
||||||
'constraints' => [
|
'constraints' => [
|
||||||
new NotBlank(),
|
new NotBlank(),
|
||||||
|
new Length(max: 255),
|
||||||
],
|
],
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
@ -37,6 +39,7 @@ class MenuType extends AbstractType
|
||||||
],
|
],
|
||||||
'constraints' => [
|
'constraints' => [
|
||||||
new NotBlank(),
|
new NotBlank(),
|
||||||
|
new Length(max: 255),
|
||||||
],
|
],
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
|
@ -7,6 +7,7 @@ use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
|
use Symfony\Component\Validator\Constraints\Length;
|
||||||
use Symfony\Component\Validator\Constraints\NotBlank;
|
use Symfony\Component\Validator\Constraints\NotBlank;
|
||||||
|
|
||||||
class NavigationAdditionalDomainType extends AbstractType
|
class NavigationAdditionalDomainType extends AbstractType
|
||||||
|
@ -24,6 +25,7 @@ class NavigationAdditionalDomainType extends AbstractType
|
||||||
],
|
],
|
||||||
'constraints' => [
|
'constraints' => [
|
||||||
new NotBlank(),
|
new NotBlank(),
|
||||||
|
new Length(max: 255),
|
||||||
],
|
],
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
|
@ -27,6 +27,7 @@ class NavigationType extends AbstractType
|
||||||
],
|
],
|
||||||
'constraints' => [
|
'constraints' => [
|
||||||
new NotBlank(),
|
new NotBlank(),
|
||||||
|
new Length(max: 255),
|
||||||
],
|
],
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
@ -41,6 +42,7 @@ class NavigationType extends AbstractType
|
||||||
],
|
],
|
||||||
'constraints' => [
|
'constraints' => [
|
||||||
new NotBlank(),
|
new NotBlank(),
|
||||||
|
new Length(max: 255),
|
||||||
],
|
],
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
@ -69,6 +71,7 @@ class NavigationType extends AbstractType
|
||||||
],
|
],
|
||||||
'constraints' => [
|
'constraints' => [
|
||||||
new NotBlank(),
|
new NotBlank(),
|
||||||
|
new Length(max: 255),
|
||||||
],
|
],
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
@ -109,7 +112,7 @@ class NavigationType extends AbstractType
|
||||||
],
|
],
|
||||||
'constraints' => [
|
'constraints' => [
|
||||||
new NotBlank(),
|
new NotBlank(),
|
||||||
new Length(['min' => 2, 'max' => 10]),
|
new Length(min: 2, max: 10),
|
||||||
],
|
],
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
|
@ -13,6 +13,7 @@ use Symfony\Component\Form\Extension\Core\Type\CollectionType;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
|
use Symfony\Component\Validator\Constraints\Length;
|
||||||
use Symfony\Component\Validator\Constraints\NotBlank;
|
use Symfony\Component\Validator\Constraints\NotBlank;
|
||||||
|
|
||||||
class NodeType extends AbstractType
|
class NodeType extends AbstractType
|
||||||
|
@ -29,6 +30,7 @@ class NodeType extends AbstractType
|
||||||
],
|
],
|
||||||
'constraints' => [
|
'constraints' => [
|
||||||
new NotBlank(),
|
new NotBlank(),
|
||||||
|
new Length(max: 255),
|
||||||
],
|
],
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
@ -43,6 +45,7 @@ class NodeType extends AbstractType
|
||||||
'attr' => [
|
'attr' => [
|
||||||
],
|
],
|
||||||
'constraints' => [
|
'constraints' => [
|
||||||
|
new Length(max: 255),
|
||||||
],
|
],
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
@ -82,6 +85,7 @@ class NodeType extends AbstractType
|
||||||
'attr' => [
|
'attr' => [
|
||||||
],
|
],
|
||||||
'constraints' => [
|
'constraints' => [
|
||||||
|
new Length(max: 255),
|
||||||
],
|
],
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
@ -116,6 +120,9 @@ class NodeType extends AbstractType
|
||||||
|
|
||||||
return $choices;
|
return $choices;
|
||||||
}),
|
}),
|
||||||
|
'constraints' => [
|
||||||
|
new Length(max: 255),
|
||||||
|
],
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
use Symfony\Component\Validator\Constraints\Image;
|
use Symfony\Component\Validator\Constraints\Image;
|
||||||
|
use Symfony\Component\Validator\Constraints\Length;
|
||||||
use Symfony\Component\Validator\Constraints\NotBlank;
|
use Symfony\Component\Validator\Constraints\NotBlank;
|
||||||
|
|
||||||
class PageType extends AbstractType
|
class PageType extends AbstractType
|
||||||
|
@ -26,6 +27,7 @@ class PageType extends AbstractType
|
||||||
],
|
],
|
||||||
'constraints' => [
|
'constraints' => [
|
||||||
new NotBlank(),
|
new NotBlank(),
|
||||||
|
new Length(max: 255),
|
||||||
],
|
],
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
@ -39,6 +41,7 @@ class PageType extends AbstractType
|
||||||
'attr' => [
|
'attr' => [
|
||||||
],
|
],
|
||||||
'constraints' => [
|
'constraints' => [
|
||||||
|
new Length(max: 255),
|
||||||
],
|
],
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
@ -52,6 +55,7 @@ class PageType extends AbstractType
|
||||||
'attr' => [
|
'attr' => [
|
||||||
],
|
],
|
||||||
'constraints' => [
|
'constraints' => [
|
||||||
|
new Length(max: 255),
|
||||||
],
|
],
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
@ -65,6 +69,7 @@ class PageType extends AbstractType
|
||||||
'attr' => [
|
'attr' => [
|
||||||
],
|
],
|
||||||
'constraints' => [
|
'constraints' => [
|
||||||
|
new Length(max: 255),
|
||||||
],
|
],
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
@ -78,6 +83,7 @@ class PageType extends AbstractType
|
||||||
'attr' => [
|
'attr' => [
|
||||||
],
|
],
|
||||||
'constraints' => [
|
'constraints' => [
|
||||||
|
new Length(max: 255),
|
||||||
],
|
],
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue