Max YO 5 سال پیش
والد
کامیت
9b70f09afa
1فایلهای تغییر یافته به همراه4 افزوده شده و 2 حذف شده
  1. 4 2
      src/Database/Sql/SqlTableModel.php

+ 4 - 2
src/Database/Sql/SqlTableModel.php

@@ -120,7 +120,7 @@ class SqlTableModel
 
 
 	// load a table row by his primary key. (usage: `$user = User::load($user_id);` )
-	public static function load($pk_where=[], $options=[])
+	public static function load($pk_where=[], $where=[], $options=[])
 	{
 		if (empty($pk_where)) {
 			return null;
@@ -134,7 +134,9 @@ class SqlTableModel
 			throw new \Exception("no primary_key defined in " . get_called_class(), 1);
 		}
 
-		$where = [];
+		if (empty($where)) {
+			$where = [];
+		}
 
 		foreach (static::$primary_key as $key) {
 			if (! isset($pk_where[$key])) {