From 7d8f38005044b9e0c6c5305ee72f4c9e9c4a3a4a Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Tue, 5 Oct 2021 13:57:04 +0200 Subject: [PATCH] entity listener added to person to capitalize names --- src/Bundle/ChillPersonBundle/Entity/Person.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/Bundle/ChillPersonBundle/Entity/Person.php b/src/Bundle/ChillPersonBundle/Entity/Person.php index 9aaad8c04..61e6f17ed 100644 --- a/src/Bundle/ChillPersonBundle/Entity/Person.php +++ b/src/Bundle/ChillPersonBundle/Entity/Person.php @@ -1775,4 +1775,18 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI return $this; } + /** + * @ORM\PrePersist + */ + + public function nameToCaps(): void + { + $firstNameCaps = ucfirst(strtolower($this->firstName)); + $this->setFirstName($firstNameCaps); + + $lastNameCaps = strtoupper($this->lastName); + $this->setLastName($lastNameCaps); + + } + }