|
@@ 209-221 (lines=13) @@
|
| 206 |
|
case ClassMetadata::GENERATOR_TYPE_AUTO: |
| 207 |
|
$class->setIdGenerator(new AutoGenerator()); |
| 208 |
|
break; |
| 209 |
|
case ClassMetadata::GENERATOR_TYPE_INCREMENT: |
| 210 |
|
$incrementGenerator = new IncrementGenerator(); |
| 211 |
|
if (isset($idGenOptions['key'])) { |
| 212 |
|
$incrementGenerator->setKey((string) $idGenOptions['key']); |
| 213 |
|
} |
| 214 |
|
if (isset($idGenOptions['collection'])) { |
| 215 |
|
$incrementGenerator->setCollection((string) $idGenOptions['collection']); |
| 216 |
|
} |
| 217 |
|
if (isset($idGenOptions['startingId'])) { |
| 218 |
|
$incrementGenerator->setStartingId((int) $idGenOptions['startingId']); |
| 219 |
|
} |
| 220 |
|
$class->setIdGenerator($incrementGenerator); |
| 221 |
|
break; |
| 222 |
|
case ClassMetadata::GENERATOR_TYPE_UUID: |
| 223 |
|
$uuidGenerator = new UuidGenerator(); |
| 224 |
|
isset($idGenOptions['salt']) && $uuidGenerator->setSalt((string) $idGenOptions['salt']); |
|
@@ 227-239 (lines=13) @@
|
| 224 |
|
isset($idGenOptions['salt']) && $uuidGenerator->setSalt((string) $idGenOptions['salt']); |
| 225 |
|
$class->setIdGenerator($uuidGenerator); |
| 226 |
|
break; |
| 227 |
|
case ClassMetadata::GENERATOR_TYPE_ALNUM: |
| 228 |
|
$alnumGenerator = new AlnumGenerator(); |
| 229 |
|
if (isset($idGenOptions['pad'])) { |
| 230 |
|
$alnumGenerator->setPad((int) $idGenOptions['pad']); |
| 231 |
|
} |
| 232 |
|
if (isset($idGenOptions['chars'])) { |
| 233 |
|
$alnumGenerator->setChars((string) $idGenOptions['chars']); |
| 234 |
|
} elseif (isset($idGenOptions['awkwardSafe'])) { |
| 235 |
|
$alnumGenerator->setAwkwardSafeMode((bool) $idGenOptions['awkwardSafe']); |
| 236 |
|
} |
| 237 |
|
|
| 238 |
|
$class->setIdGenerator($alnumGenerator); |
| 239 |
|
break; |
| 240 |
|
case ClassMetadata::GENERATOR_TYPE_CUSTOM: |
| 241 |
|
if (empty($idGenOptions['class'])) { |
| 242 |
|
throw MappingException::missingIdGeneratorClass($class->name); |