src/Leevel/Database/Ddd/Entity.php
public function refresh(): void
    {
        $key = $this->primaryKey();

        if (null === $key) {
            $e = sprintf('Entity %s do not have primary key.', static::class);

            throw new InvalidArgumentException($e);
        }

        if (is_array($key)) {
            $map = $this->id();
        } else {
            $map = [$this->singlePrimaryKey(), $this->id()];
        }

        $data = $this
            ->metaConnect()
            ->select()
            ->where($map)
            ->findOne();

        foreach ($data as $k => $v) {
            $this->withPropValue($k, $v, false);
        }
    }
public function refresh(): void
    {
        $key = $this->primaryKey();

        if (null === $key) {
            $e = sprintf('Entity %s do not have primary key.', static::class);

            throw new InvalidArgumentException($e);
        }

        if (is_array($key)) {
            $map = $this->id();
        } else {
            $map = [$this->singlePrimaryKey(), $this->id()];
        }

        $data = $this
            ->metaConnect()
            ->select()
            ->where($map)
            ->findOne();

        foreach ($data as $k => $v) {
            $this->withPropValue($k, $v, false);
        }
    }
从数据库重新读取当前对象的属性.