php - ORM 'or_where' use -


i'd orm factory return records x = 1 , y either equal 1 or 2. i've tried few variations and_where, returns loads more records should. orm stored in php variable. here's current code

$tests = orm::factory('test')     ->where('x', '=', 1)     ->or_where('y', '=', 1)     ->or_where('y', '=', 2)     ->find_all(); 

you can group or statements via and_where_open()/and_where_close() (untested)

$test = orm::factory('test')     ->where('x', '=', 1)     // 1     ->and_where_open()       // 2     ->where('y', '=', 1)     // 3     ->or_where('y', '=', 2)  // 4     ->and_where_close()     ->find_all(); 

this should create query like

select .. .. x = 1   , (  y=1   or y=2  )                         ^^^^^   ^^^^^  ^^^   ^^^^^^                           1       2     3      4 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -