@@ 1842-1854 (lines=13) @@ | ||
1839 | if( $otherObject instanceof EE_Base_Class ) { |
|
1840 | $otherObject->clear_cache( $this->get_model()->get_this_model_name(), $this ); |
|
1841 | } |
|
1842 | } else { |
|
1843 | //this thing doesn't exist in the DB, so just cache it |
|
1844 | if( ! $otherObjectModelObjectOrID instanceof EE_Base_Class){ |
|
1845 | throw new EE_Error( sprintf( |
|
1846 | __( 'Before a model object is saved to the database, calls to _add_relation_to must be passed an actual object, not just an ID. You provided %s as the model object to a %s', 'event_espresso' ), |
|
1847 | $otherObjectModelObjectOrID, |
|
1848 | get_class( $this ) |
|
1849 | )); |
|
1850 | } else { |
|
1851 | $otherObject = $otherObjectModelObjectOrID; |
|
1852 | } |
|
1853 | $this->cache( $relationName, $otherObjectModelObjectOrID, $cache_id ); |
|
1854 | } |
|
1855 | if( $otherObject instanceof EE_Base_Class ) { |
|
1856 | //fix the reciprocal relation too |
|
1857 | if( $otherObject->ID() ) { |
@@ 2390-2396 (lines=7) @@ | ||
2387 | * @return EE_Base_Class |
|
2388 | */ |
|
2389 | public function get_one_conflicting($obj_or_fields_array, $include_primary_key = true ){ |
|
2390 | if($obj_or_fields_array instanceof EE_Base_Class){ |
|
2391 | $fields_n_values = $obj_or_fields_array->model_field_array(); |
|
2392 | }elseif( is_array($obj_or_fields_array)){ |
|
2393 | $fields_n_values = $obj_or_fields_array; |
|
2394 | }else{ |
|
2395 | throw new EE_Error( |
|
2396 | sprintf( |
|
2397 | __( |
|
2398 | "%s get_all_conflicting should be called with a model object or an array of field names and values, you provided %d", |
|
2399 | "event_espresso" |
|
@@ 4654-4660 (lines=7) @@ | ||
4651 | */ |
|
4652 | public function get_all_copies($model_object_or_attributes_array, $query_params = array()){ |
|
4653 | ||
4654 | if($model_object_or_attributes_array instanceof EE_Base_Class){ |
|
4655 | $attributes_array = $model_object_or_attributes_array->model_field_array(); |
|
4656 | }elseif(is_array($model_object_or_attributes_array)){ |
|
4657 | $attributes_array = $model_object_or_attributes_array; |
|
4658 | }else{ |
|
4659 | throw new EE_Error(sprintf(__("get_all_copies should be provided with either a model object or an array of field-value-pairs, but was given %s", "event_espresso"),$model_object_or_attributes_array)); |
|
4660 | } |
|
4661 | //even copies obviously won't have the same ID, so remove the primary key |
|
4662 | //from the WHERE conditions for finding copies (if there is a primary key, of course) |
|
4663 | if($this->has_primary_key_field() && isset($attributes_array[$this->primary_key_name()])){ |