eee
This commit is contained in:
+4
-2
@@ -1,4 +1,5 @@
|
|||||||
<?php /** @noinspection ALL */
|
<?php
|
||||||
|
/** @noinspection ALL */
|
||||||
/**
|
/**
|
||||||
* Created by PhpStorm.
|
* Created by PhpStorm.
|
||||||
* User: whwyy
|
* User: whwyy
|
||||||
@@ -234,8 +235,9 @@ abstract class Model extends Component implements ModelInterface, ArrayAccess, \
|
|||||||
* @return Model|null
|
* @return Model|null
|
||||||
* @throws
|
* @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();
|
$model = static::instance();
|
||||||
$query = new ActiveQuery($model);
|
$query = new ActiveQuery($model);
|
||||||
$query->from($model->getTable())->alias('t1');
|
$query->from($model->getTable())->alias('t1');
|
||||||
|
|||||||
+2
-2
@@ -18,10 +18,10 @@ interface ModelInterface
|
|||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array|string|int $param
|
* @param array|string|int|null $param
|
||||||
* @return ModelInterface|null
|
* @return ModelInterface|null
|
||||||
*/
|
*/
|
||||||
public static function findOne(array|string|int $param): ?static;
|
public static function findOne(array|string|int|null $param): ?static;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user