@@ 225-237 (lines=13) @@ | ||
222 | case ClassMetadata::GENERATOR_TYPE_AUTO: |
|
223 | $class->setIdGenerator(new AutoGenerator()); |
|
224 | break; |
|
225 | case ClassMetadata::GENERATOR_TYPE_INCREMENT: |
|
226 | $incrementGenerator = new IncrementGenerator(); |
|
227 | if (isset($idGenOptions['key'])) { |
|
228 | $incrementGenerator->setKey((string) $idGenOptions['key']); |
|
229 | } |
|
230 | if (isset($idGenOptions['collection'])) { |
|
231 | $incrementGenerator->setCollection((string) $idGenOptions['collection']); |
|
232 | } |
|
233 | if (isset($idGenOptions['startingId'])) { |
|
234 | $incrementGenerator->setStartingId((int) $idGenOptions['startingId']); |
|
235 | } |
|
236 | $class->setIdGenerator($incrementGenerator); |
|
237 | break; |
|
238 | case ClassMetadata::GENERATOR_TYPE_UUID: |
|
239 | $uuidGenerator = new UuidGenerator(); |
|
240 | if (isset($idGenOptions['salt'])) { |
|
@@ 245-257 (lines=13) @@ | ||
242 | } |
|
243 | $class->setIdGenerator($uuidGenerator); |
|
244 | break; |
|
245 | case ClassMetadata::GENERATOR_TYPE_ALNUM: |
|
246 | $alnumGenerator = new AlnumGenerator(); |
|
247 | if (isset($idGenOptions['pad'])) { |
|
248 | $alnumGenerator->setPad((int) $idGenOptions['pad']); |
|
249 | } |
|
250 | if (isset($idGenOptions['chars'])) { |
|
251 | $alnumGenerator->setChars((string) $idGenOptions['chars']); |
|
252 | } elseif (isset($idGenOptions['awkwardSafe'])) { |
|
253 | $alnumGenerator->setAwkwardSafeMode((bool) $idGenOptions['awkwardSafe']); |
|
254 | } |
|
255 | ||
256 | $class->setIdGenerator($alnumGenerator); |
|
257 | break; |
|
258 | case ClassMetadata::GENERATOR_TYPE_CUSTOM: |
|
259 | if (empty($idGenOptions['class'])) { |
|
260 | throw MappingException::missingIdGeneratorClass($class->name); |