改名
This commit is contained in:
@@ -27,6 +27,7 @@ use Database\Relation;
|
|||||||
use Exception;
|
use Exception;
|
||||||
use Snowflake\Exception\ComponentException;
|
use Snowflake\Exception\ComponentException;
|
||||||
use Snowflake\Exception\NotFindClassException;
|
use Snowflake\Exception\NotFindClassException;
|
||||||
|
use static;
|
||||||
use validator\Validator;
|
use validator\Validator;
|
||||||
use Database\IOrm;
|
use Database\IOrm;
|
||||||
use Snowflake\Snowflake;
|
use Snowflake\Snowflake;
|
||||||
@@ -431,17 +432,20 @@ abstract class BaseActiveRecord extends Component implements IOrm, ArrayAccess
|
|||||||
/**
|
/**
|
||||||
* @param $lastId
|
* @param $lastId
|
||||||
* @param $param
|
* @param $param
|
||||||
* @return mixed
|
* @return static
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
private function setPrimary($lastId, $param): mixed
|
private function setPrimary($lastId, $param): static
|
||||||
{
|
{
|
||||||
if ($this->hasAutoIncrement()) {
|
if ($this->hasAutoIncrement()) {
|
||||||
return $this->setAttribute($this->getAutoIncrement(), (int)$lastId);
|
$this->setAttribute($this->getAutoIncrement(), (int)$lastId);
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->hasPrimary()) {
|
if (!$this->hasPrimary()) {
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
$primary = $this->getPrimary();
|
$primary = $this->getPrimary();
|
||||||
if (!isset($param[$primary]) || empty($param[$primary])) {
|
if (!isset($param[$primary]) || empty($param[$primary])) {
|
||||||
$this->setAttribute($primary, (int)$lastId);
|
$this->setAttribute($primary, (int)$lastId);
|
||||||
|
|||||||
Reference in New Issue
Block a user