| @@ 2635-2641 (lines=7) @@ | ||
| 2632 | */ |
|
| 2633 | public function get_one_conflicting($obj_or_fields_array, $include_primary_key = true) |
|
| 2634 | { |
|
| 2635 | if ($obj_or_fields_array instanceof EE_Base_Class) { |
|
| 2636 | $fields_n_values = $obj_or_fields_array->model_field_array(); |
|
| 2637 | } elseif (is_array($obj_or_fields_array)) { |
|
| 2638 | $fields_n_values = $obj_or_fields_array; |
|
| 2639 | } else { |
|
| 2640 | throw new EE_Error( |
|
| 2641 | sprintf( |
|
| 2642 | __( |
|
| 2643 | "%s get_all_conflicting should be called with a model object or an array of field names and values, you provided %d", |
|
| 2644 | "event_espresso" |
|
| @@ 5212-5218 (lines=7) @@ | ||
| 5209 | */ |
|
| 5210 | public function get_all_copies($model_object_or_attributes_array, $query_params = array()) |
|
| 5211 | { |
|
| 5212 | if ($model_object_or_attributes_array instanceof EE_Base_Class) { |
|
| 5213 | $attributes_array = $model_object_or_attributes_array->model_field_array(); |
|
| 5214 | } elseif (is_array($model_object_or_attributes_array)) { |
|
| 5215 | $attributes_array = $model_object_or_attributes_array; |
|
| 5216 | } else { |
|
| 5217 | 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", |
|
| 5218 | "event_espresso"), $model_object_or_attributes_array)); |
|
| 5219 | } |
|
| 5220 | //even copies obviously won't have the same ID, so remove the primary key |
|
| 5221 | //from the WHERE conditions for finding copies (if there is a primary key, of course) |
|
| @@ 1840-1852 (lines=13) @@ | ||
| 1837 | if( $otherObject instanceof EE_Base_Class ) { |
|
| 1838 | $otherObject->clear_cache( $this->get_model()->get_this_model_name(), $this ); |
|
| 1839 | } |
|
| 1840 | } else { |
|
| 1841 | //this thing doesn't exist in the DB, so just cache it |
|
| 1842 | if( ! $otherObjectModelObjectOrID instanceof EE_Base_Class){ |
|
| 1843 | throw new EE_Error( sprintf( |
|
| 1844 | __( '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' ), |
|
| 1845 | $otherObjectModelObjectOrID, |
|
| 1846 | get_class( $this ) |
|
| 1847 | )); |
|
| 1848 | } else { |
|
| 1849 | $otherObject = $otherObjectModelObjectOrID; |
|
| 1850 | } |
|
| 1851 | $this->cache( $relationName, $otherObjectModelObjectOrID, $cache_id ); |
|
| 1852 | } |
|
| 1853 | if( $otherObject instanceof EE_Base_Class ) { |
|
| 1854 | //fix the reciprocal relation too |
|
| 1855 | if( $otherObject->ID() ) { |
|