@@ 258-270 (lines=13) @@ | ||
255 | case ClassMetadata::GENERATOR_TYPE_AUTO: |
|
256 | $class->setIdGenerator(new AutoGenerator()); |
|
257 | break; |
|
258 | case ClassMetadata::GENERATOR_TYPE_INCREMENT: |
|
259 | $incrementGenerator = new IncrementGenerator(); |
|
260 | if (isset($idGenOptions['key'])) { |
|
261 | $incrementGenerator->setKey((string) $idGenOptions['key']); |
|
262 | } |
|
263 | if (isset($idGenOptions['collection'])) { |
|
264 | $incrementGenerator->setCollection((string) $idGenOptions['collection']); |
|
265 | } |
|
266 | if (isset($idGenOptions['startingId'])) { |
|
267 | $incrementGenerator->setStartingId((int) $idGenOptions['startingId']); |
|
268 | } |
|
269 | $class->setIdGenerator($incrementGenerator); |
|
270 | break; |
|
271 | case ClassMetadata::GENERATOR_TYPE_UUID: |
|
272 | $uuidGenerator = new UuidGenerator(); |
|
273 | if (isset($idGenOptions['salt'])) { |
|
@@ 278-290 (lines=13) @@ | ||
275 | } |
|
276 | $class->setIdGenerator($uuidGenerator); |
|
277 | break; |
|
278 | case ClassMetadata::GENERATOR_TYPE_ALNUM: |
|
279 | $alnumGenerator = new AlnumGenerator(); |
|
280 | if (isset($idGenOptions['pad'])) { |
|
281 | $alnumGenerator->setPad((int) $idGenOptions['pad']); |
|
282 | } |
|
283 | if (isset($idGenOptions['chars'])) { |
|
284 | $alnumGenerator->setChars((string) $idGenOptions['chars']); |
|
285 | } elseif (isset($idGenOptions['awkwardSafe'])) { |
|
286 | $alnumGenerator->setAwkwardSafeMode((bool) $idGenOptions['awkwardSafe']); |
|
287 | } |
|
288 | ||
289 | $class->setIdGenerator($alnumGenerator); |
|
290 | break; |
|
291 | case ClassMetadata::GENERATOR_TYPE_CUSTOM: |
|
292 | if (empty($idGenOptions['class'])) { |
|
293 | throw MappingException::missingIdGeneratorClass($class->name); |