简体   繁体   中英

Method chaining with the same method

$db->SELECT("tablename")->WHERE()
$db->update("tablename")->WHERE()
Etc..

How can I determine in the WHERE method what method that was called first? I want to use the same WHERE method on both SELECT, update and delete.

Is it Even possible? Thanks!

I think that make not really sense to call a where clause more then one time.

If you build you own system you should take a look at Doctrine for example. Here are functions like

where
andWhere
orWhere

So you can call where only one time but you can call the other functions more then one time and build statement.

http://doctrine-orm.readthedocs.org/en/latest/reference/query-builder.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM