File tree Expand file tree Collapse file tree 2 files changed +4
-7
lines changed Expand file tree Collapse file tree 2 files changed +4
-7
lines changed Original file line number Diff line number Diff line change 33namespace ShipMonkTests \DoctrineEntityPreloader \Fixtures \Blog ;
44
55use function base64_encode ;
6- use function random_int ;
76
87class PrimaryKey
98{
109
1110 public const DOCTRINE_TYPE_NAME = 'primary_key ' ;
12- public const LENGTH_BYTES = 4 ;
11+
12+ private static int $ autoIncrement = 0 ;
1313
1414 private int $ data ;
1515
@@ -20,10 +20,7 @@ public function __construct(int $data)
2020
2121 public static function new (): self
2222 {
23- $ bits = self ::LENGTH_BYTES * 8 ;
24- $ maxValue = (1 << $ bits ) - 1 ;
25-
26- return new self (random_int (0 , $ maxValue ));
23+ return new self (self ::$ autoIncrement ++);
2724 }
2825
2926 public function getData (): int
Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ public function getSQLDeclaration(
5656 ): string
5757 {
5858 return $ platform ->getBinaryTypeDeclarationSQL ([
59- 'length ' => PrimaryKey:: LENGTH_BYTES ,
59+ 'length ' => 4 ,
6060 'fixed ' => true ,
6161 ]);
6262 }
You can’t perform that action at this time.
0 commit comments