There is an is_deleted column available in user table.
While a user is deleted then record not deleted just is_deleted is set to 1.
Then i create new user with same phone number. it's display unique validation error.
I want to skip is_deleted record in validation.
My UserProfiles Entity
<?php
/**
* UserProfiles
*
* @ORM\Table(name="user_profiles")
* @ORM\Entity
*/
class UserProfiles
{
/**
* @var string
*
* @ORM\Column(name="phone_number", type="string", length=255, nullable=false)
*/
private $phoneNumber;
/**
* @ORM\OneToOne(targetEntity="ApiBundle\Entity\Users", inversedBy="userProfile")
* @ORM\JoinColumn(name="user_id", referencedColumnName="id", onDelete="CASCADE")
*/
private $user;
Validation constraint yml.
ApiBundle\Entity\UserProfiles:
constraints:
- Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity:
fields: [phoneNumber]
errorPath: phone_number
message: "Phone number is already exists."
I want to add user.is_deleted in fields:[phoneNumber, user.is_deleted]