79735211

Date: 2025-08-14 09:42:31
Score: 0.5
Natty:
Report link

Maybe the unique parameter in the column annotation could help you?

#[ORM\Column(unique: true, name: "app_id", type: Types::BIGINT)]
private ?int $appId = null;

If the user is supposed to be unique, maybe a OneToOne Relation could be better than a ManyToOne. I am pretty sure using OneToOne will also generate a unique index in your migration for you, even without the unique parameter.

#[ORM\OneToOne(inversedBy: 'userMobileApp', cascade: ['persist', 'remove'])]
#[ORM\JoinColumn(name: "user_id, "nullable: false)]
private ?User $user = null;
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • Low reputation (1):
Posted by: Daka