public function testValidateUniquenessNotToStringEntityWithAssociatedEntity() { $constraint =
new UniqueEntity([ 'message' => 'myMessage',
'fields' =>
['single'
],
'em' => self::EM_NAME,
]);
$entity1 =
new SingleIntIdNoToStringEntity(1, 'foo'
);
$associated =
new AssociationEntity2();
$associated->single =
$entity1;
$associated2 =
new AssociationEntity2();
$associated2->single =
$entity1;
$this->em->
persist($entity1);
$this->em->
persist($associated);
$this->em->
flush();
$this->validator->
validate($associated,
$constraint);
$this->
assertNoViolation();