Skip to content
This repository was archived by the owner on Jan 24, 2024. It is now read-only.

Commit 59fb4c2

Browse files
authored
Update ManyToManyRelation.php
1 parent bebc77c commit 59fb4c2

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

source/Spiral/ORM/Entities/Relations/ManyToManyRelation.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -178,11 +178,11 @@ public function link(RecordInterface $record, array $pivotData = []): self
178178
//Ensure reference
179179
$record = $this->matchOne($record) ?? $record;
180180

181-
if (in_array($record, $this->instances)) {
181+
if (in_array($record, $this->instances, true)) {
182182
//Merging pivot data
183183
$this->pivotData->offsetSet($record, $pivotData + $this->getPivot($record));
184184

185-
if (!in_array($record, $this->updated) && !in_array($record, $this->scheduled)) {
185+
if (!in_array($record, $this->updated, true) && !in_array($record, $this->scheduled, true)) {
186186
//Indicating that record pivot data has been changed
187187
$this->updated[] = $record;
188188
}
@@ -267,13 +267,13 @@ public function queueCommands(ContextualCommandInterface $parentCommand): Comman
267267
$transaction->addCommand($recordCommand = $record->queueStore(), true);
268268

269269
//Create or refresh link between records
270-
if (in_array($record, $this->scheduled)) {
270+
if (in_array($record, $this->scheduled, true)) {
271271
//Create link
272272
$command = new InsertCommand(
273273
$this->pivotTable(),
274274
$this->pivotData->offsetGet($record)
275275
);
276-
} elseif (in_array($record, $this->updated)) {
276+
} elseif (in_array($record, $this->updated, true)) {
277277
//Update link (expecting both records to be already loaded)
278278
$command = new UpdateCommand(
279279
$this->pivotTable(),

0 commit comments

Comments
 (0)