function test_add_model_relation_chain_onto_where_conditions()
 {
     global $current_user;
     $current_user = $this->factory->user->create_and_get();
     $value1 = 12;
     $value2 = 23;
     $value3 = array(1, 2, 3);
     $value4 = 'eee';
     $default_where_conditions = new EE_Default_Where_Conditions();
     $default_where_conditions->_finalize_construct(EEM_Event::instance());
     $this->assertEquals(array('OR*' => array('Event.EVT_ID' => $value1, 'Event.Datetime.DTT_ID' => $value2), 'AND' => array('Event.EVT_name' => array('IN', $value3), 'Event.Datetime.DTT_name' => $value4), 'Event.EVT_wp_user' => $current_user->ID), $default_where_conditions->prepare_where_conditions_for_querying(array('OR*' => array('EVT_ID' => $value1, 'Datetime.DTT_ID' => $value2), 'AND' => array('EVT_name' => array('IN', $value3), 'Datetime.DTT_name' => $value4), EEM_Event::instance()->wp_user_field_name() => EE_Default_Where_Conditions::current_user_placeholder), 'Event.'));
 }
Ejemplo n.º 2
0
 /**
  * Uses the _default_where_conditions_strategy set during __construct() to get
  * default where conditions on all get_all, update, and delete queries done by this model.
  * Use the same syntax as client code. Eg on the Event model, use array('Event.EVT_post_type'=>'esp_event'),
  * NOT array('Event_CPT.post_type'=>'esp_event').
  * @param string $model_relation_path eg, path from Event to Payment is "Registration.Transaction.Payment."
  * @return array like EEM_Base::get_all's $query_params[0] (where conditions)
  */
 private function _get_default_where_conditions($model_relation_path = null)
 {
     if ($this->_ignore_where_strategy) {
         return array();
     }
     return $this->_default_where_conditions_strategy->get_default_where_conditions($model_relation_path);
 }