Klaas Naaijkens
2011-08-16 19:24:12 UTC
Hi, I am using the entity type form element to add a tag to a post when I am
saving a Post entity.
Now this tag table contains a lot of tags, over 20.000. The problem is that
the entity type loads all
the tags from the table when I am validating the form. I have no problem
with the rendering as
I do not render the form directly, but use autocomplete to make the user
select an already existing
Tag. The problem comes when saving the form.
I don't think I can use the query builder to limit the result as all the
20.000 tags would be valid, so
I can't limit it there directly.
What would be the best way to move this forward? Create my own FormType
perhaps?
$builder->add('post_title', 'text', array('required' => true,
'error_bubbling' => true));
$builder->add('post_content', 'textarea', array('required' => true,
'error_bubbling' => true));
$builder->add('posts_tags',
'entity',
array(
'class' => 'Tag',
'property' =>'tag_name',
'multiple' => true
)
);
Regards,
Klaas
--
If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com
You received this message because you are subscribed to the Google
Groups "Symfony2" group.
To post to this group, send email to symfony2-/***@public.gmane.org
To unsubscribe from this group, send email to
symfony2+unsubscribe-/***@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/symfony2?hl=en
saving a Post entity.
Now this tag table contains a lot of tags, over 20.000. The problem is that
the entity type loads all
the tags from the table when I am validating the form. I have no problem
with the rendering as
I do not render the form directly, but use autocomplete to make the user
select an already existing
Tag. The problem comes when saving the form.
I don't think I can use the query builder to limit the result as all the
20.000 tags would be valid, so
I can't limit it there directly.
What would be the best way to move this forward? Create my own FormType
perhaps?
$builder->add('post_title', 'text', array('required' => true,
'error_bubbling' => true));
$builder->add('post_content', 'textarea', array('required' => true,
'error_bubbling' => true));
$builder->add('posts_tags',
'entity',
array(
'class' => 'Tag',
'property' =>'tag_name',
'multiple' => true
)
);
Regards,
Klaas
--
If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com
You received this message because you are subscribed to the Google
Groups "Symfony2" group.
To post to this group, send email to symfony2-/***@public.gmane.org
To unsubscribe from this group, send email to
symfony2+unsubscribe-/***@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/symfony2?hl=en