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

Commit eaae82e

Browse files
authored
Merge pull request #1 from imanghafoori1/master
Flatten code
2 parents a6cd5b6 + 54c04ee commit eaae82e

File tree

1 file changed

+12
-18
lines changed

1 file changed

+12
-18
lines changed

src/UnderstandsCommit.php

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -104,25 +104,19 @@ protected static function committedDelete($callback)
104104
*/
105105
protected function markNativeEventForCommitAction($commitAction)
106106
{
107-
if (static::$registeredCommitActions[$commitAction] > 0) {
108-
109-
if ($this->getConnection()->transactionLevel() <= 0) {
110-
111-
$this->fireModelEvent($commitAction);
112-
113-
} else {
114-
115-
TransactionEventsSubscriber::addModelCallback($this, function () use ($commitAction) {
116-
117-
$this->fireModelEvent($commitAction);
118-
119-
});
120-
121-
}
122-
107+
if (static::$registeredCommitActions[$commitAction] <= 0) {
108+
return $this;
109+
}
110+
111+
if ($this->getConnection()->transactionLevel() <= 0) {
112+
$this->fireModelEvent($commitAction);
113+
return $this;
123114
}
124115

125-
116+
TransactionEventsSubscriber::addModelCallback($this, function () use ($commitAction) {
117+
$this->fireModelEvent($commitAction);
118+
});
119+
126120
return $this;
127121
}
128122

@@ -140,4 +134,4 @@ protected static function nativeEventsToTransactionEvents()
140134
'deleted' => 'committedDelete',
141135
];
142136
}
143-
}
137+
}

0 commit comments

Comments
 (0)