public static function create($generatorType)
{
switch ($generatorType) {
case ClassMetadata::IDGENERATOR_ASSIGNED:
$instance = new AssignedIdGenerator();
break;
case ClassMetadata::IDGENERATOR_UUID:
$instance = new CouchUUIDGenerator();
break;
default:
throw new \Exception("ID Generator does not exist!");
}
return $instance;
}
private function getIdGenerator($type) { if (!isset($this->idGenerators[$type])) { $this->idGenerators[$type] = Id\IdGenerator::create($type); } return $this->idGenerators[$type]; }