From d6cf2de4abd55917e4f5b390e0521e8b201e9b0e Mon Sep 17 00:00:00 2001 From: Korina Cordero Date: Tue, 9 Nov 2021 08:33:11 +0000 Subject: [PATCH] Create service to generate a unique id. #638 --- src/Service/UniqueIdGenerator.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/Service/UniqueIdGenerator.php diff --git a/src/Service/UniqueIdGenerator.php b/src/Service/UniqueIdGenerator.php new file mode 100644 index 00000000..c0a91d0c --- /dev/null +++ b/src/Service/UniqueIdGenerator.php @@ -0,0 +1,22 @@ +em = $em; + } + + public function generateUniqueId($str_length) + { + // TODO: retry until we get a unique id + + return substr(md5(time()), 0, $str_length); + } +}