@@ 246-258 (lines=13) @@ | ||
243 | case ClassMetadata::GENERATOR_TYPE_AUTO: |
|
244 | $class->setIdGenerator(new AutoGenerator()); |
|
245 | break; |
|
246 | case ClassMetadata::GENERATOR_TYPE_INCREMENT: |
|
247 | $incrementGenerator = new IncrementGenerator(); |
|
248 | if (isset($idGenOptions['key'])) { |
|
249 | $incrementGenerator->setKey((string) $idGenOptions['key']); |
|
250 | } |
|
251 | if (isset($idGenOptions['collection'])) { |
|
252 | $incrementGenerator->setCollection((string) $idGenOptions['collection']); |
|
253 | } |
|
254 | if (isset($idGenOptions['startingId'])) { |
|
255 | $incrementGenerator->setStartingId((int) $idGenOptions['startingId']); |
|
256 | } |
|
257 | $class->setIdGenerator($incrementGenerator); |
|
258 | break; |
|
259 | case ClassMetadata::GENERATOR_TYPE_UUID: |
|
260 | $uuidGenerator = new UuidGenerator(); |
|
261 | if (isset($idGenOptions['salt'])) { |
|
@@ 266-278 (lines=13) @@ | ||
263 | } |
|
264 | $class->setIdGenerator($uuidGenerator); |
|
265 | break; |
|
266 | case ClassMetadata::GENERATOR_TYPE_ALNUM: |
|
267 | $alnumGenerator = new AlnumGenerator(); |
|
268 | if (isset($idGenOptions['pad'])) { |
|
269 | $alnumGenerator->setPad((int) $idGenOptions['pad']); |
|
270 | } |
|
271 | if (isset($idGenOptions['chars'])) { |
|
272 | $alnumGenerator->setChars((string) $idGenOptions['chars']); |
|
273 | } elseif (isset($idGenOptions['awkwardSafe'])) { |
|
274 | $alnumGenerator->setAwkwardSafeMode((bool) $idGenOptions['awkwardSafe']); |
|
275 | } |
|
276 | ||
277 | $class->setIdGenerator($alnumGenerator); |
|
278 | break; |
|
279 | case ClassMetadata::GENERATOR_TYPE_CUSTOM: |
|
280 | if (empty($idGenOptions['class'])) { |
|
281 | throw MappingException::missingIdGeneratorClass($class->name); |