@@ 1984-1996 (lines=13) @@ | ||
1981 | if ($otherObject instanceof EE_Base_Class) { |
|
1982 | $otherObject->clear_cache($this->get_model()->get_this_model_name(), $this); |
|
1983 | } |
|
1984 | } else { |
|
1985 | //this thing doesn't exist in the DB, so just cache it |
|
1986 | if ( ! $otherObjectModelObjectOrID instanceof EE_Base_Class) { |
|
1987 | throw new EE_Error(sprintf( |
|
1988 | __('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', |
|
1989 | 'event_espresso'), |
|
1990 | $otherObjectModelObjectOrID, |
|
1991 | get_class($this) |
|
1992 | )); |
|
1993 | } else { |
|
1994 | $otherObject = $otherObjectModelObjectOrID; |
|
1995 | } |
|
1996 | $this->cache($relationName, $otherObjectModelObjectOrID, $cache_id); |
|
1997 | } |
|
1998 | if ($otherObject instanceof EE_Base_Class) { |
|
1999 | //fix the reciprocal relation too |
@@ 2785-2791 (lines=7) @@ | ||
2782 | */ |
|
2783 | public function get_one_conflicting($obj_or_fields_array, $include_primary_key = true) |
|
2784 | { |
|
2785 | if ($obj_or_fields_array instanceof EE_Base_Class) { |
|
2786 | $fields_n_values = $obj_or_fields_array->model_field_array(); |
|
2787 | } elseif (is_array($obj_or_fields_array)) { |
|
2788 | $fields_n_values = $obj_or_fields_array; |
|
2789 | } else { |
|
2790 | throw new EE_Error( |
|
2791 | sprintf( |
|
2792 | __( |
|
2793 | "%s get_all_conflicting should be called with a model object or an array of field names and values, you provided %d", |
|
2794 | "event_espresso" |
|
@@ 5505-5511 (lines=7) @@ | ||
5502 | */ |
|
5503 | public function get_all_copies($model_object_or_attributes_array, $query_params = array()) |
|
5504 | { |
|
5505 | if ($model_object_or_attributes_array instanceof EE_Base_Class) { |
|
5506 | $attributes_array = $model_object_or_attributes_array->model_field_array(); |
|
5507 | } elseif (is_array($model_object_or_attributes_array)) { |
|
5508 | $attributes_array = $model_object_or_attributes_array; |
|
5509 | } else { |
|
5510 | 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", |
|
5511 | "event_espresso"), $model_object_or_attributes_array)); |
|
5512 | } |
|
5513 | //even copies obviously won't have the same ID, so remove the primary key |
|
5514 | //from the WHERE conditions for finding copies (if there is a primary key, of course) |