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

, ['Created_at', '<', Time ()-$ H*3600] #896

Open
tig3306 opened this issue Nov 2, 2024 · 9 comments
Open

, ['Created_at', '<', Time ()-$ H*3600] #896

tig3306 opened this issue Nov 2, 2024 · 9 comments

Comments

@tig3306
Copy link

tig3306 commented Nov 2, 2024

What steps will reproduce the problem?

What is the expected result?

The comparative operator should be placed in the middle or it will become very detouring
For example, ['Created_at', '<', Time ()-$ H*3600]
It should be more likely to change this like a mathematical formula

What do you get instead?

Additional info

Q A
Version 1.0.?
PHP version
Operating system
@xepozz
Copy link
Member

xepozz commented Nov 2, 2024

->where('Created_at <' . Time()-$H*3600)

Here you can use it instead.

I'm not sure the position of the operator would change.

@vjik
Copy link
Member

vjik commented Nov 2, 2024

Cycle ORM used this order. What about other ORM / DB abstractions?

@Tigrov
Copy link
Member

Tigrov commented Nov 2, 2024

Usially it is [operator, column name, value]
For example, ['<', 'Created_at', time() - $H*3600]

The documentation
https://github.com/yiisoft/db/blob/master/docs/guide/en/query/where.md

@samdark
Copy link
Member

samdark commented Nov 3, 2024

The reason for current operator-parameters is that there are such operators as not where the format proposed doesn't fit. Current schema works for any operator but is, indeed, is not very natural.

@tig3306
Copy link
Author

tig3306 commented Nov 6, 2024

I've already fixed it myself You guys don't use this kind of work Too tongue-twisting I hope to change it to the same as a normal mathematical formula It's more convenient

Usially it is [operator, column name, value] For example, ['<', 'Created_at', time() - $H*3600]

The documentation https://github.com/yiisoft/db/blob/master/docs/guide/en/query/where.md

I've already fixed it myself You guys don't use this kind of work Too tongue-twisting I hope to change it to the same as a normal mathematical formula It's more convenient

@tig3306
Copy link
Author

tig3306 commented Nov 6, 2024

->where('Created_at <' . Time()-$H*3600)

Here you can use it instead.

I'm not sure the position of the operator would change.

I'm more repulsive to the string pattern It's easy to make mistakes Because the IDE tool is not compatible with strings I don't recommend that way of writing

@tig3306
Copy link
Author

tig3306 commented Nov 6, 2024

The reason for current operator-parameters is that there are such operators as not where the format proposed doesn't fit. Current schema works for any operator but is, indeed, is not very natural.

We've grown up with mathematical formulas a-b=c mode You're not used to writing like that

@tig3306
Copy link
Author

tig3306 commented Nov 6, 2024

Usially it is [operator, column name, value] For example, ['<', 'Created_at', time() - $H*3600]

The documentation https://github.com/yiisoft/db/blob/master/docs/guide/en/query/where.md

We've grown up with mathematical formulas a-b=c mode You're not used to writing like that

@samdark
Copy link
Member

samdark commented Nov 6, 2024

Sure, I understand that this format isn't natural to what anyone's used to, but how to deal with, for example, the following?

['and', 'sum>10', '!is_deleted', 'is_active']

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

No branches or pull requests

5 participants