-
Notifications
You must be signed in to change notification settings - Fork 29
Shouldn't ID be hidden in edit and new forms #94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I think they should simply not be part of the form. But this imply we add some logic on "default" behavior analyzing what is the primary key on so on. That could be great! |
This is not top priority, as you can easily control which fields are displayed by customizing the |
But you can't say which properties you don't want, right? Like blacklisting. |
@matejvelikonja currently there is one way to do that: if you wish to "blacklist" fields, you could do that by extending the FormType. <?php
namespace Acme\DemoBundle\Form\Type\Post;
use Admingenerated\AcmeDemoBundle\Form\BasePostType\EditType as BaseEditType;
use Symfony\Component\Form\FormBuilderInterface;
/**
* EditType
*/
class EditType extends BaseEditType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
parent::buildForm($builder, $options);
// assuming you let "by default" all fields
// you can blacklist a specific field by removeing it in the form type
$builder->remove('id');
}
} |
Also, I don't actually see value in implementing a "blacklist" feature. As metioned above - we could detect the "primary key" and not include it by default, but "blacklisting" more fields is IMHO doing it the wrong way. |
Hi,
No, but by default, if you define which ones you want, others ones are not included |
When you have auto generated Id it makes sense that you cannot edit or create it. It's should be hidden by default.
The text was updated successfully, but these errors were encountered: