This commit is contained in:
xl
2024-08-27 11:19:22 +08:00
parent 8d917b0f92
commit beb48f41d2
2 changed files with 6 additions and 4 deletions
+4 -2
View File
@@ -1,4 +1,5 @@
<?php /** @noinspection ALL */
<?php
/** @noinspection ALL */
/**
* Created by PhpStorm.
* User: whwyy
@@ -234,8 +235,9 @@ abstract class Model extends Component implements ModelInterface, ArrayAccess, \
* @return Model|null
* @throws
*/
public static function findOne(int|string|array $param): ?static
public static function findOne(int|string|array|null $param): ?static
{
if (empty($param)) return null;
$model = static::instance();
$query = new ActiveQuery($model);
$query->from($model->getTable())->alias('t1');
+2 -2
View File
@@ -18,10 +18,10 @@ interface ModelInterface
{
/**
* @param array|string|int $param
* @param array|string|int|null $param
* @return ModelInterface|null
*/
public static function findOne(array|string|int $param): ?static;
public static function findOne(array|string|int|null $param): ?static;
/**