Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

升级到 tp 5.0.8 后,insert 后获取不到 _id #33

Open
Cailiang opened this issue May 4, 2017 · 9 comments
Open

升级到 tp 5.0.8 后,insert 后获取不到 _id #33

Cailiang opened this issue May 4, 2017 · 9 comments

Comments

@Cailiang
Copy link
Contributor

Cailiang commented May 4, 2017

tp5 framework 升级是不是太随意了,每次升级原来的代码总会出各种问题 。

@liu21st
Copy link
Member

liu21st commented May 5, 2017

你的核心框架升级 think-mongo扩展有更新没?

@Cailiang
Copy link
Contributor Author

Cailiang commented May 5, 2017

我们用的是 1.6, 您刚刚发布的2.0也不能直接用于 tp_V5.0.8 吧,刚测试了一下 :
Declaration of think\mongo\Query::parsePkWhere($data) should be compatible with think\db\Query::parsePkWhere($data, &$options)

@liu21st
Copy link
Member

liu21st commented May 5, 2017

1.* 版本对应的还是 5.0.* 核心
2.0版本对应的是 5.1核心框架
你说的问题 我回头再查下原因

@Cailiang
Copy link
Contributor Author

Cailiang commented May 5, 2017

我发了 Pull request 您有时间看看

@liu21st
Copy link
Member

liu21st commented May 5, 2017

model的问题我修正了 获取ID我测试正常

@Cailiang
Copy link
Contributor Author

Cailiang commented May 5, 2017

通过 $this->getData($this->getPk()); 取不到

public function upsert($modInfo)
{
$isupdate = false;
if(!empty($modInfo['_id'])){
$isupdate = true;
}
$result = $this->isUpdate($isupdate)->validate()->save($modInfo);
if (!$result && !empty($this->getError())) {
$e = $this->getError();
exception(15001, [$e]);
}
return $this->getData($this->getPk());
}

@liu21st
Copy link
Member

liu21st commented May 5, 2017

这个问题应该不是mongo扩展的问题 我修正了核心框架

@Cailiang
Copy link
Contributor Author

Cailiang commented May 5, 2017

对所以我说 tp5 framework 升级会不会太随意了,没有考虑到一些扩展的兼容,对于我们来说改framework影响太大。改扩展来兼容新的框架成本低一些 😆

@liu21st
Copy link
Member

liu21st commented May 5, 2017

嗯 确实考虑还不够周全! 框架更新原本也是为了解决一些遗留和发现的问题~其实模型和数据库本来不想动的,但心中也有所纠结 不能明知存在问题而不改进 所以5.0.8版本引入了一些5.1版本的思想在里面 但确实有点牵一发而动全身的感觉 百密一疏 导致扩展兼容性问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants