mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-02 13:12:49 +08:00
改进Model类是__unset和__isset方法判断
This commit is contained in:
@@ -1975,7 +1975,7 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
|
||||
public function __isset($name)
|
||||
{
|
||||
try {
|
||||
if (array_key_exists($name, $this->data)) {
|
||||
if (array_key_exists($name, $this->data) || array_key_exists($name, $this->relation)) {
|
||||
return true;
|
||||
} else {
|
||||
$this->getAttr($name);
|
||||
@@ -1995,7 +1995,7 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
|
||||
*/
|
||||
public function __unset($name)
|
||||
{
|
||||
unset($this->data[$name]);
|
||||
unset($this->data[$name], $this->relation[$name]);
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
|
||||
Reference in New Issue
Block a user