|
12 | 12 | use App\Exceptions\InsufficientEntropyException; |
13 | 13 | use App\Exceptions\Internal\NotImplementedException; |
14 | 14 | use App\Exceptions\Internal\TimeBasedIdException; |
15 | | -use App\Models\Configs; |
16 | 15 | use Illuminate\Database\Eloquent\Builder; |
17 | 16 | use Illuminate\Database\Eloquent\InvalidCastException; |
18 | 17 | use Illuminate\Database\Eloquent\JsonEncodingException; |
@@ -64,9 +63,6 @@ public function setAttribute($key, $value): mixed |
64 | 63 | if ($key === $this->getKeyName()) { |
65 | 64 | throw new NotImplementedException('must not set primary key explicitly, primary key will be set on first insert'); |
66 | 65 | } |
67 | | - if ($key === RandomID::LEGACY_ID_NAME) { |
68 | | - throw new NotImplementedException('must not set legacy key explicitly, legacy key will be set on first insert'); |
69 | | - } |
70 | 66 |
|
71 | 67 | return parent::setAttribute($key, $value); |
72 | 68 | } |
@@ -170,27 +166,6 @@ private function generateKey(): void |
170 | 166 | } catch (\Exception $e) { |
171 | 167 | throw new InsufficientEntropyException($e); |
172 | 168 | } |
173 | | - // @codeCoverageIgnoreEnd |
174 | | - if ( |
175 | | - PHP_INT_MAX === 2147483647 || |
176 | | - Configs::getValueAsBool('force_32bit_ids') |
177 | | - ) { |
178 | | - // For 32-bit installations, we can only afford to store the |
179 | | - // full seconds in id. The calling code needs to be able to |
180 | | - // handle duplicate ids. Note that this also exposes us to |
181 | | - // the year 2038 problem. |
182 | | - // @codeCoverageIgnoreStart |
183 | | - $legacy_id = sprintf('%010d', microtime(true)); |
184 | | - // @codeCoverageIgnoreEnd |
185 | | - } else { |
186 | | - // Ensure 4 digits after the decimal point, 15 characters |
187 | | - // total (including the decimal point), 0-padded on the |
188 | | - // left if needed (shouldn't be needed unless we move back in |
189 | | - // time :-) ) |
190 | | - $legacy_id = sprintf('%015.4f', microtime(true)); |
191 | | - $legacy_id = str_replace('.', '', $legacy_id); |
192 | | - } |
193 | 169 | $this->attributes[$this->getKeyName()] = $id; |
194 | | - $this->attributes[RandomID::LEGACY_ID_NAME] = intval($legacy_id); |
195 | 170 | } |
196 | 171 | } |
0 commit comments