diff options
| -rw-r--r-- | lib/classes/SimpleORMap.php | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/lib/classes/SimpleORMap.php b/lib/classes/SimpleORMap.php index 6e2f044..9861a1d 100644 --- a/lib/classes/SimpleORMap.php +++ b/lib/classes/SimpleORMap.php @@ -2582,45 +2582,6 @@ abstract class SimpleORMap implements ArrayAccess, Countable, IteratorAggregate self::$mariadb_column_default_fix = $state; } - public static function firstOrCreate(array $attributes, array $values = []): static - { - $whereClauses = []; - foreach ($attributes as $key => $value) { - $whereClauses[] = "$key = :$key"; - } - - $record = static::findOneBySQL(implode(' AND ', $whereClauses), $attributes); - if ($record) { - return $record; - } - - return static::create([ - ...$attributes, - ...$values - ]); - } - - public static function updateOrCreate(array $attributes, array $values = []): static - { - $whereClauses = []; - foreach ($attributes as $key => $value) { - $whereClauses[] = "$key = :$key"; - } - - $record = static::findOneBySQL(implode(' AND ', $whereClauses), $attributes); - - if ($record) { - $record->setData($values); - $record->store(); - return $record; - } - - return static::create([ - ...$attributes, - ...$values - ]); - } - // new query builder: private array $wheres = []; |
