score:0
multiple things :
first, i can see a potential typo issue in what you've shown so far as in the table constraint annotation you reference to the column "language_id" ( singular ) whereas in your uniqueentity annotation you reference to the fiel "languages" ( plural ), so maybe try to double check your field / column definition.
the 2 ways you are trying to create your constraint have different purposes :
@orm\uniqueconstraint
is meant to generate schema changes in the database by adding a sql unique constraint. doing this enforces your database engine to check every entry in the said table and generate an error ( exemple : "error #1062" for mysql ) which can be relayed by the pdo into your php output.
@uniqueentity
on the other hand, uniqueentity is meant to validate your php entity ( doing a $form->isvalid() for exemple ) by firing a select statement against your database and checking if there are any results similar to the submitted values.
point is, reading carrefully and understanding the exception you are getting back will help you understand which constraint exactly causes the issue and finding the cause (is it an issue with the datas already in base ?).
moreover, depending on what you need to do, you may not need to include the 2 constraints, and only use the @uniqueentity or the @uniqueconstraint.
edit :
you could try to use the repositorymethod option to enforce the request used for validation by creating your own repository method.
hope this helps
Source: stackoverflow.com
Related Query
- Symfony Form fails to validate multiple uniqueEntity fields
- Symfony Form Validation: UniqueEntity - multiple fields - including one nullable field
- Symfony validate form with mapped false form fields
- Symfony Form / FormBuilder: How to add an option or attribute to multiple form fields
- Symfony 2 : How to concatenate multiple fields into one in a form
- How can i create one form who contains multiple forms as fields using collectionType in symfony 4?
- Symfony 2 - Multiple form fields for one database row
- Symfony 2 : Validate form for defined fields only
- How customize multiple fields in a Symfony form template?
- What would be the symfony way of handling assigning a global value to multiple form fields
- Building Symfony 2 Custom Validator that Uses Multiple Fields
- Avoid Symfony forcing form fields display
- how to split long symfony form in multiple pages?
- One field should not be blank if some fields are blank in Symfony Form
- Validate a form field against multiple constraints
- Symfony 2 This form should not contain extra fields
- Symfony 2 - rearrange form fields
- Symfony 4 multiple entities in single form
- How to handle multiple nested Form Collections in Symfony 2.0?
- Symfony 2 Doctrime 2 and form validate ( unique field )
- How to validate Symfony 2 form on client side (javascript)
- Symfony Twig Form Theming of specific fields
- Symfony 2 form extra fields
- Upload multiple files using Symfony form
- Multiple form include symfony (same page)
- Symfony add form fields in frontend
- Symfony form required only on custom validator fields
- How I can validate only some validation groups based on some fields in the form itself in Symfony2
- One form for multiple addresses in Symfony - Twig
- Symfony - How to add form fields that are not embeeded in the underlying object
More Query from same tag
- Is it sensible to use symfony as native app api?
- Setting property value in custom form type
- Symfony FormBuilder - custom option for additional element?
- Migrating to FOSUserBundle
- symfony2: including inline javascript
- symfony upgrade to 3.4 mplementing DataCollectorInterface
- Can't do redirect after login
- How to query doctrine for dependent entities in Symfony2 controller
- Steps to create Multiple database in symfony 2.0
- Separating frontend development in Symfony2 framework
- Doctrine\DBAL\Schema\SchemaException: How to include one or more FKs in a declared table index
- Symfony validate email without assert
- symfony swiftmailer variable line breaks
- Symfony 2.4 project deployment without SSH
- Using Symfony NamespacedAttributeBags in a Controller
- Api-platform request issue
- How to add a collection when register a new user using Symfony 2.6 FosUser 1.3
- FOSUerBundle override template not working
- Symfony skeleton project server callback / wrongly styled
- Symfony access control for site root
- Netbeans, Symfony and hinting driving me mad
- Symfony, entity vs repository
- Symfony2 removing from collection does not persist OneToMany
- Translations shared between Symfony2 and Angular.JS
- Html5Validation
- Doctrine withh multiple AND OR conditions
- Symfony-CMF managing content with phpMyAdmin and general questions about architecture
- Symfony2 FOSUserBundle Invitation : only work on owning side associations
- symfony 5 how to mock/replace service in container
- How to get the value of a form field through the form class in symfony2?