You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Possibility to change length constraints validation of message #650
Have you planned the possibiliy to override the min length of the body by adding a group or something ? My users are annoyed 'cause they can't comment with :) !
changed the title [-]Possibility to change length constraints of message[/-][+]Possibility to change length constraints validation of message[/+]on Apr 12, 2018
namespace AppBundle\Form\Extension;
use FOS\CommentBundle\Form\CommentType;
use Symfony\Component\Form\AbstractTypeExtension;
use Symfony\Component\OptionsResolver\OptionsResolver;
class CommentTypeExtension extends AbstractTypeExtension
{
/**
* Returns the name of the type being extended.
*
* @return string The name of the type being extended
*/
public function getExtendedType()
{
return CommentType::class;
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefault('validation_groups', array('AppComment'));
}
}
hello aless673,
I tried to do like you, but i have an error :
(2/2) LoaderLoadException
There is no extension able to load the configuration for
"FOS\CommentBundle\Model\Comment" (in /var/www/web/config/packages/validator.yaml).
Looked for namespace "FOS\CommentBundle\Model\Comment",
found "fos_js_routing", "doctrine_cache", "doctrine", "doctrine_migrations",
"sensio_framework_extra", "monolog", "security", "swiftmailer",
"twig", "web_server", "maker", "debug", "web_profiler", "acl",
"framework", "liip_imagine", "knp_gaufrette", "vich_uploader",
"exercise_html_purifier", "presta_sitemap", "jms_serializer",
"fos_rest", "fos_comment", "fos_user", "nelmio_api_doc",
"snc_redis", "stfalcon_tinymce", "eight_points_guzzle",
"fos_elastica", "stof_doctrine_extensions", "hwi_oauth",
"httplug", "crawler_detect", "webpack_encore", "mercure"
in /var/www/web/config/packages/validator.yaml
(which is loaded in resource "/var/www/web/config/packages/validator.yaml").
hello aless673,
I tried to do like you, but i have an error :
(2/2) LoaderLoadException
There is no extension able to load the configuration for
"FOS\CommentBundle\Model\Comment" (in /var/www/web/config/packages/validator.yaml).
Looked for namespace "FOS\CommentBundle\Model\Comment",
found "fos_js_routing", "doctrine_cache", "doctrine", "doctrine_migrations",
"sensio_framework_extra", "monolog", "security", "swiftmailer",
"twig", "web_server", "maker", "debug", "web_profiler", "acl",
"framework", "liip_imagine", "knp_gaufrette", "vich_uploader",
"exercise_html_purifier", "presta_sitemap", "jms_serializer",
"fos_rest", "fos_comment", "fos_user", "nelmio_api_doc",
"snc_redis", "stfalcon_tinymce", "eight_points_guzzle",
"fos_elastica", "stof_doctrine_extensions", "hwi_oauth",
"httplug", "crawler_detect", "webpack_encore", "mercure"
in /var/www/web/config/packages/validator.yaml
(which is loaded in resource "/var/www/web/config/packages/validator.yaml").
Note: I Use Symfony 4.2
Thanks
Hi, it seems that your validator.yaml is in the wrong directory for Symfony 4.2
Activity
[-]Possibility to change length constraints of message[/-][+]Possibility to change length constraints validation of message[/+]aless673 commentedon Oct 12, 2018
Hi,
I was facing the same problem and i resolved it by using Form Extension : https://symfony.com/doc/3.4/form/create_form_type_extension.html
src/AppBundle/Form/Extension/CommentTypeExtension.php
app/config/services.yml
src/AppBundle/Resources/config/validation.yml
Can also solve #252 and #444
sle160292 commentedon Apr 19, 2019
hello aless673,
I tried to do like you, but i have an error :
Note: I Use Symfony 4.2
Thanks
aless673 commentedon Apr 21, 2019
Hi, it seems that your validator.yaml is in the wrong directory for Symfony 4.2
Try to put it in :
config/validator/validation.yaml