2022-01-09 03:49:51 +08:00
|
|
|
<?php
|
|
|
|
|
/**
|
|
|
|
|
* Created by PhpStorm.
|
|
|
|
|
* User: whwyy
|
|
|
|
|
* Date: 2018/3/30 0030
|
|
|
|
|
* Time: 14:39
|
|
|
|
|
*/
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
namespace Database;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Interface ModelInterface
|
|
|
|
|
* @package Database
|
|
|
|
|
*/
|
|
|
|
|
interface ModelInterface
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
/**
|
2023-04-11 17:05:03 +08:00
|
|
|
* @param array|string|int $param
|
2022-01-09 03:49:51 +08:00
|
|
|
* @param null $db
|
2023-04-11 17:05:03 +08:00
|
|
|
* @return ModelInterface|null
|
2022-01-09 03:49:51 +08:00
|
|
|
*/
|
2023-04-11 17:05:03 +08:00
|
|
|
public static function findOne(array|string|int $param, $db = NULL): ?static;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param int $param
|
|
|
|
|
* @param null $db
|
|
|
|
|
* @return ModelInterface|null
|
|
|
|
|
*/
|
|
|
|
|
public static function primary(int $param, $db = NULL): ?static;
|
2022-01-09 03:49:51 +08:00
|
|
|
|
|
|
|
|
|
2022-01-20 19:04:15 +08:00
|
|
|
/**
|
|
|
|
|
* @param array $data
|
|
|
|
|
* @return static
|
|
|
|
|
*/
|
|
|
|
|
public static function populate(array $data): static;
|
2022-01-09 03:49:51 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return ActiveQuery
|
|
|
|
|
* return a sql queryBuilder
|
|
|
|
|
*/
|
|
|
|
|
public static function query(): ActiveQuery;
|
|
|
|
|
|
|
|
|
|
|
2022-01-20 19:04:15 +08:00
|
|
|
/**
|
2022-02-14 17:56:53 +08:00
|
|
|
* @return ?string
|
2022-01-20 19:04:15 +08:00
|
|
|
*/
|
2022-02-14 17:56:53 +08:00
|
|
|
public function getPrimary(): ?string;
|
2022-01-20 19:04:15 +08:00
|
|
|
|
|
|
|
|
|
2022-01-09 03:49:51 +08:00
|
|
|
/**
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
|
|
|
|
public function getTable(): string;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return Connection
|
|
|
|
|
*/
|
|
|
|
|
public function getConnection(): Connection;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|