| @@ 2019-2031 (lines=13) @@ | ||
| 2016 | if ($otherObject instanceof EE_Base_Class) { |
|
| 2017 | $otherObject->clear_cache($model->get_this_model_name(), $this); |
|
| 2018 | } |
|
| 2019 | } else { |
|
| 2020 | //this thing doesn't exist in the DB, so just cache it |
|
| 2021 | if ( ! $otherObjectModelObjectOrID instanceof EE_Base_Class) { |
|
| 2022 | throw new EE_Error(sprintf( |
|
| 2023 | __('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', |
|
| 2024 | 'event_espresso'), |
|
| 2025 | $otherObjectModelObjectOrID, |
|
| 2026 | get_class($this) |
|
| 2027 | )); |
|
| 2028 | } else { |
|
| 2029 | $otherObject = $otherObjectModelObjectOrID; |
|
| 2030 | } |
|
| 2031 | $this->cache($relationName, $otherObjectModelObjectOrID, $cache_id); |
|
| 2032 | } |
|
| 2033 | if ($otherObject instanceof EE_Base_Class) { |
|
| 2034 | //fix the reciprocal relation too |
|
| @@ 2864-2870 (lines=7) @@ | ||
| 2861 | */ |
|
| 2862 | public function get_one_conflicting($obj_or_fields_array, $include_primary_key = true) |
|
| 2863 | { |
|
| 2864 | if ($obj_or_fields_array instanceof EE_Base_Class) { |
|
| 2865 | $fields_n_values = $obj_or_fields_array->model_field_array(); |
|
| 2866 | } elseif (is_array($obj_or_fields_array)) { |
|
| 2867 | $fields_n_values = $obj_or_fields_array; |
|
| 2868 | } else { |
|
| 2869 | throw new EE_Error( |
|
| 2870 | sprintf( |
|
| 2871 | __( |
|
| 2872 | "%s get_all_conflicting should be called with a model object or an array of field names and values, you provided %d", |
|
| 2873 | "event_espresso" |
|
| @@ 5613-5619 (lines=7) @@ | ||
| 5610 | */ |
|
| 5611 | public function get_all_copies($model_object_or_attributes_array, $query_params = array()) |
|
| 5612 | { |
|
| 5613 | if ($model_object_or_attributes_array instanceof EE_Base_Class) { |
|
| 5614 | $attributes_array = $model_object_or_attributes_array->model_field_array(); |
|
| 5615 | } elseif (is_array($model_object_or_attributes_array)) { |
|
| 5616 | $attributes_array = $model_object_or_attributes_array; |
|
| 5617 | } else { |
|
| 5618 | 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", |
|
| 5619 | "event_espresso"), $model_object_or_attributes_array)); |
|
| 5620 | } |
|
| 5621 | //even copies obviously won't have the same ID, so remove the primary key |
|
| 5622 | //from the WHERE conditions for finding copies (if there is a primary key, of course) |
|