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

Bug related to SoftDelete #546

Closed
nadar opened this issue Aug 4, 2020 · 2 comments · Fixed by #548
Closed

Bug related to SoftDelete #546

nadar opened this issue Aug 4, 2020 · 2 comments · Fixed by #548
Assignees
Labels

Comments

@nadar
Copy link
Member

nadar commented Aug 4, 2020

I am not sure yet, just saw the error, have to research. maybe related to #542

image

Update with potential Fix

In order to fix querys with SoftDeleteTrait like this:

UserOnline::find()
->select(['lock_pk', 'lock_table', 'last_timestamp', 'u.firstname', 'u.lastname', 'u.id'])
->where(['!=', 'u.id', $userId])
->joinWith('user as u')
->asArray()
->all()

use instead the full table name in the field selection (and where condition)

UserOnline::find()
->select(['lock_pk', 'lock_table', 'last_timestamp', 'firstname', 'lastname', 'admin_user.id'])
->where(['!=', 'admin_user.id', $userId])
->joinWith('user')
->asArray()
->all()
@nadar
Copy link
Member Author

nadar commented Aug 4, 2020

@boehsermoe if the table name is aliased your proposed solution won't work. Maybe we should use $query["{{%$field}}"] = (is_array($value)) ? $value[1] : !$value; instead which is the yii table prefix syntax

I have prepared a PR with the test situation which is failing #548

@nadar nadar mentioned this issue Aug 4, 2020
@nadar nadar added bug and removed bug:research labels Aug 4, 2020
@boehsermoe
Copy link
Member

Looks like a bigger problem 😕 yiisoft/active-record#33

@nadar nadar closed this as completed in #548 Aug 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants