改名
This commit is contained in:
@@ -296,7 +296,7 @@ class ActiveRecord extends BaseActiveRecord
|
|||||||
private function runRelate(): array
|
private function runRelate(): array
|
||||||
{
|
{
|
||||||
$relates = [];
|
$relates = [];
|
||||||
if (empty($this->_with)) {
|
if (empty($with = $this->getWith())) {
|
||||||
return $relates;
|
return $relates;
|
||||||
}
|
}
|
||||||
foreach ($this->_with as $val) {
|
foreach ($this->_with as $val) {
|
||||||
@@ -305,6 +305,25 @@ class ActiveRecord extends BaseActiveRecord
|
|||||||
return $relates;
|
return $relates;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $data
|
||||||
|
* @return ActiveRecord
|
||||||
|
*/
|
||||||
|
public function setWith($data): static
|
||||||
|
{
|
||||||
|
$this->_with = $data;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array|null
|
||||||
|
*/
|
||||||
|
public function getWith(): array|null
|
||||||
|
{
|
||||||
|
return $this->_with;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $modelName
|
* @param string $modelName
|
||||||
|
|||||||
@@ -147,26 +147,6 @@ abstract class BaseActiveRecord extends Component implements IOrm, ArrayAccess
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param $data
|
|
||||||
* @return BaseActiveRecord
|
|
||||||
*/
|
|
||||||
public function setWith($data): static
|
|
||||||
{
|
|
||||||
$this->_with = $data;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return array|null
|
|
||||||
*/
|
|
||||||
public function getWith(): array|null
|
|
||||||
{
|
|
||||||
return $this->_with;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $name
|
* @param $name
|
||||||
* @param $method
|
* @param $method
|
||||||
|
|||||||
Reference in New Issue
Block a user