feat: unique email addresses of participants unless child, cleanup
addresses #869axbn21
This commit is contained in:
@@ -224,4 +224,26 @@ class ParticipantDto
|
||||
'message' => $message,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if the participant is a child based on age at current date.
|
||||
*
|
||||
* A child is defined as someone under the specified age threshold (default: 16 years).
|
||||
* This classification is used for email uniqueness validation (children can share emails with adults).
|
||||
*
|
||||
* @param int $ageThreshold The age threshold for child classification (default: 16)
|
||||
*
|
||||
* @return bool True if participant is under the age threshold, false otherwise or if age unknown
|
||||
*/
|
||||
public function isChild(int $ageThreshold = 16): bool
|
||||
{
|
||||
$age = $this->getAge();
|
||||
|
||||
// Treat unknown age as adult for safety (requires email uniqueness)
|
||||
if (null === $age) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $ageThreshold > $age;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user