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