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

tp6 BelongsToMany关联模型加field报错:strpos() expects parameter 1 to be string, object given #1116

Closed
felixwann opened this issue Oct 26, 2022 · 3 comments

Comments

@felixwann
Copy link

ThinkPHP版本:6.0.0
think-orm:2.0
image

@felixwann
Copy link
Author

加上这一串代码,问题解决了

if ($field instanceof \think\db\Raw) {
    $field = $field->getValue();
}

image

@felixwann felixwann changed the title strpos() expects parameter 1 to be string, object given tp6 模型field报错:strpos() expects parameter 1 to be string, object given Oct 26, 2022
@felixwann felixwann changed the title tp6 模型field报错:strpos() expects parameter 1 to be string, object given tp6 BelongsToMany关联模型加field报错:strpos() expects parameter 1 to be string, object given Oct 26, 2022
@shirne
Copy link

shirne commented Oct 26, 2022

加上这一串代码,问题解决了

应该判断是Db::raw就跳过吧,用了raw就是不希望系统再适配的

@zcenet
Copy link

zcenet commented Dec 22, 2022 via email

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

3 participants