Skip to content

Commit a141614

Browse files
committed
Rename getBaseQuery method to toBase
1 parent 8bb0199 commit a141614

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

src/Relations/EmbedsMany.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function performInsert(Model $model)
5252
}
5353

5454
// Push the new model to the database.
55-
$result = $this->getBaseQuery()->push($this->localKey, $model->getAttributes(), true);
55+
$result = $this->toBase()->push($this->localKey, $model->getAttributes(), true);
5656

5757
// Attach the model to its parent.
5858
if ($result) {
@@ -83,7 +83,7 @@ public function performUpdate(Model $model)
8383
$values = $this->getUpdateValues($model->getDirty(), $this->localKey.'.$.');
8484

8585
// Update document in database.
86-
$result = $this->getBaseQuery()->where($this->localKey.'.'.$model->getKeyName(), $foreignKey)
86+
$result = $this->toBase()->where($this->localKey.'.'.$model->getKeyName(), $foreignKey)
8787
->update($values);
8888

8989
// Attach the model to its parent.
@@ -112,7 +112,7 @@ public function performDelete(Model $model)
112112
// Get the correct foreign key value.
113113
$foreignKey = $this->getForeignKeyValue($model);
114114

115-
$result = $this->getBaseQuery()->pull($this->localKey, [$model->getKeyName() => $foreignKey]);
115+
$result = $this->toBase()->pull($this->localKey, [$model->getKeyName() => $foreignKey]);
116116

117117
if ($result) {
118118
$this->dissociate($model);

src/Relations/EmbedsOne.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function performInsert(Model $model)
5050
return $this->parent->save() ? $model : false;
5151
}
5252

53-
$result = $this->getBaseQuery()->update([$this->localKey => $model->getAttributes()]);
53+
$result = $this->toBase()->update([$this->localKey => $model->getAttributes()]);
5454

5555
// Attach the model to its parent.
5656
if ($result) {
@@ -76,7 +76,7 @@ public function performUpdate(Model $model)
7676

7777
$values = $this->getUpdateValues($model->getDirty(), $this->localKey.'.');
7878

79-
$result = $this->getBaseQuery()->update($values);
79+
$result = $this->toBase()->update($values);
8080

8181
// Attach the model to its parent.
8282
if ($result) {
@@ -101,7 +101,7 @@ public function performDelete()
101101
}
102102

103103
// Overwrite the local key with an empty array.
104-
$result = $this->getBaseQuery()->update([$this->localKey => null]);
104+
$result = $this->toBase()->update([$this->localKey => null]);
105105

106106
// Detach the model from its parent.
107107
if ($result) {

src/Relations/EmbedsOneOrMany.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ protected function getForeignKeyValue($id)
246246
}
247247

248248
// Convert the id to MongoId if necessary.
249-
return $this->getBaseQuery()->convertKey($id);
249+
return $this->toBase()->convertKey($id);
250250
}
251251

252252
/**
@@ -322,7 +322,7 @@ public function getQuery()
322322
/**
323323
* @inheritdoc
324324
*/
325-
public function getBaseQuery()
325+
public function toBase()
326326
{
327327
// Because we are sharing this relation instance to models, we need
328328
// to make sure we use separate query instances.

0 commit comments

Comments
 (0)