Skip to content

Commit 4af19fb

Browse files
committed
Set default salt in generate() call removing the need for an exception.
1 parent 53cf649 commit 4af19fb

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

lib/Doctrine/ODM/MongoDB/Id/UuidGenerator.php

+1-6
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ public function setSalt($salt)
5454
*/
5555
public function getSalt()
5656
{
57-
if (!isset($this->salt)) $this->setSalt(php_uname('n'));
5857
return $this->salt;
5958
}
6059

@@ -76,12 +75,8 @@ public function isValid($guid)
7675
*/
7776
public function generate(DocumentManager $dm, $document)
7877
{
79-
if (!$this->salt) {
80-
throw new \Exception('Guid Generator requires a salt to be provided.');
81-
}
82-
8378
$guid = $this->generateV4();
84-
return $this->generateV5($guid, $this->salt);
79+
return $this->generateV5($guid, $this->salt ?: php_uname('n'));
8580
}
8681

8782
/**

0 commit comments

Comments
 (0)