ENTITY
use Doctrine\\ORM\\Mapping as ORM;
use Symfony\\Component\\Validator\\Constraints as Assert;
use Symfony\\Bridge\\Doctrine\\Validator\\Co
Duplicate entry '38-1233-123' for key 'accountID'
If you want to check the uniqueness of accountId alone, add this to your class:
@UniqueEntity(fields={"accountID"}, message="This account is already taken")
Here the full code that check the uniqueness of the combinaison "keyID", "vCode", "accountID" and also the uniqueness of "accountID" alone:
I don't know if you saw that the error only affect the field accountID, if you don't want this behavior just remove "unique=true" from your property $accountID.
If you just want to say that the cominaison "keyID", "vCode", "accountID" must be unique in the database, proceed like that:
/**
* @ORM\Table(name="_apiKey",
* uniqueConstraints = {
* @ORM\UniqueConstraint(name="_api_key_key_id_v_code_account_id", columns={"keyID", "vCode", "accountID})
* }
* )
*
* ...
* etc, ...
*/
class apiKey