Skip to content

Commit b9cc872

Browse files
Smolevichjenssegers
authored andcommitted
Revert changes in Builder and Model for id keys, fix test for Queue (#1795)
* Revert changes in Builder and Model for id keys, fix test for Queue * Fix format in Model
1 parent 4ef3483 commit b9cc872

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

Diff for: src/Jenssegers/Mongodb/Eloquent/Model.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ abstract class Model extends BaseModel
3232
* @var string
3333
*/
3434
protected $primaryKey = '_id';
35-
35+
3636
/**
3737
* The primary key type.
3838
*
@@ -175,7 +175,7 @@ protected function getAttributeFromArray($key)
175175
public function setAttribute($key, $value)
176176
{
177177
// Convert _id to ObjectID.
178-
if (($key == '_id' || Str::endsWith($key, '_id')) && is_string($value)) {
178+
if ($key == '_id' && is_string($value)) {
179179
$builder = $this->newBaseQueryBuilder();
180180

181181
$value = $builder->convertKey($value);

Diff for: src/Jenssegers/Mongodb/Query/Builder.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -906,7 +906,7 @@ protected function compileWheres()
906906
}
907907

908908
// Convert id's.
909-
if (isset($where['column']) && ($where['column'] == '_id' || Str::endsWith($where['column'], '_id'))) {
909+
if (isset($where['column']) && ($where['column'] == '_id' || Str::endsWith($where['column'], '._id'))) {
910910
// Multiple values.
911911
if (isset($where['values'])) {
912912
foreach ($where['values'] as &$value) {

Diff for: tests/QueueTest.php

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public function testQueueJobLifeCycle()
2424
'displayName' => 'test',
2525
'job' => 'test',
2626
'maxTries' => null,
27+
'delay' => null,
2728
'timeout' => null,
2829
'data' => ['action' => 'QueueJobLifeCycle'],
2930
]), $job->getRawBody());

0 commit comments

Comments
 (0)