@@ 2268-2274 (lines=7) @@ | ||
2265 | * @return EE_Base_Class |
|
2266 | */ |
|
2267 | public function get_one_conflicting($obj_or_fields_array, $include_primary_key = true ){ |
|
2268 | if($obj_or_fields_array instanceof EE_Base_Class){ |
|
2269 | $fields_n_values = $obj_or_fields_array->model_field_array(); |
|
2270 | }elseif( is_array($obj_or_fields_array)){ |
|
2271 | $fields_n_values = $obj_or_fields_array; |
|
2272 | }else{ |
|
2273 | throw new EE_Error(sprintf(__("%s get_all_conflicting should be called with a model object or an array of field names and values, you provided %d", "event_espresso"),get_class($this),$obj_or_fields_array)); |
|
2274 | } |
|
2275 | $query_params = array(); |
|
2276 | if( $this->has_primary_key_field() && |
|
2277 | ( $include_primary_key || $this->get_primary_key_field() instanceof EE_Primary_Key_String_Field) && |
|
@@ 4284-4290 (lines=7) @@ | ||
4281 | */ |
|
4282 | public function get_all_copies($model_object_or_attributes_array, $query_params = array()){ |
|
4283 | ||
4284 | if($model_object_or_attributes_array instanceof EE_Base_Class){ |
|
4285 | $attributes_array = $model_object_or_attributes_array->model_field_array(); |
|
4286 | }elseif(is_array($model_object_or_attributes_array)){ |
|
4287 | $attributes_array = $model_object_or_attributes_array; |
|
4288 | }else{ |
|
4289 | 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)); |
|
4290 | } |
|
4291 | //even copies obviously won't have the same ID, so remove the primary key |
|
4292 | //from the WHERE conditions for finding copies (if there is a primary key, of course) |
|
4293 | if($this->has_primary_key_field() && isset($attributes_array[$this->primary_key_name()])){ |
@@ 1706-1718 (lines=13) @@ | ||
1703 | if( $otherObject instanceof EE_Base_Class ) { |
|
1704 | $otherObject->clear_cache( $this->get_model()->get_this_model_name(), $this ); |
|
1705 | } |
|
1706 | } else { |
|
1707 | //this thing doesn't exist in the DB, so just cache it |
|
1708 | if( ! $otherObjectModelObjectOrID instanceof EE_Base_Class){ |
|
1709 | throw new EE_Error( sprintf( |
|
1710 | __( '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' ), |
|
1711 | $otherObjectModelObjectOrID, |
|
1712 | get_class( $this ) |
|
1713 | )); |
|
1714 | } else { |
|
1715 | $otherObject = $otherObjectModelObjectOrID; |
|
1716 | } |
|
1717 | $this->cache( $relationName, $otherObjectModelObjectOrID, $cache_id ); |
|
1718 | } |
|
1719 | if( $otherObject instanceof EE_Base_Class ) { |
|
1720 | //fix the reciprocal relation too |
|
1721 | if( $otherObject->ID() ) { |