Skip to content

Commit

Permalink
Move Record class ->beginTransaction down to not conflict wiht startT…
Browse files Browse the repository at this point in the history
…ransaction
  • Loading branch information
nicksagona committed Dec 14, 2023
1 parent 9d5cd5e commit ee4f4d7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Record.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,15 +204,15 @@ public static function start(): static|null
{
$args = func_get_args();
$class = get_called_class();
if (Db::hasDb($class)) {
Db::db($class)->beginTransaction();
}

if ($class !== 'Pop\Db\Record') {
$record = (!empty($args)) ? (new \ReflectionClass($class))->newInstanceArgs($args) : new static();
$record->startTransaction();
return $record;
} else {
if (Db::hasDb($class)) {
Db::db($class)->beginTransaction();
}
return null;
}
}
Expand Down

0 comments on commit ee4f4d7

Please sign in to comment.