| @@ 99-107 (lines=9) @@ | ||
| 96 | $join_model_fk_to_other_model->get_name() => $other_model_obj->ID()); |
|
| 97 | ||
| 98 | //if $where_query exists lets add them to the query_params. |
|
| 99 | if ( !empty( $extra_join_model_fields_n_values ) ) { |
|
| 100 | //make sure we strip any of the join model names from the $where_query cause we don't need that in here (why? because client code may have used the same conditionals for get_all_related which DOES need the join model name) |
|
| 101 | //make sure we strip THIS models name from the query param |
|
| 102 | foreach ( $extra_join_model_fields_n_values as $query_param => $val ) { |
|
| 103 | $query_param = str_replace($this->get_join_model()->get_this_model_name().".","", $query_param); |
|
| 104 | $parsed_query[$query_param] = $val; |
|
| 105 | } |
|
| 106 | $cols_n_values = array_merge( $cols_n_values, $parsed_query ); |
|
| 107 | } |
|
| 108 | ||
| 109 | $query_params = array( $cols_n_values ); |
|
| 110 | ||
| @@ 140-148 (lines=9) @@ | ||
| 137 | $join_model_fk_to_other_model->get_name() => $other_model_obj->ID()); |
|
| 138 | ||
| 139 | //if $where_query exists lets add them to the query_params. |
|
| 140 | if ( !empty( $where_query ) ) { |
|
| 141 | //make sure we strip any of the join model names from the $where_query cause we don't need that in here (why? because client code may have used the same conditionals for get_all_related which DOES need the join model name) |
|
| 142 | //make sure we strip THIS models name from the query param |
|
| 143 | foreach ( $where_query as $query_param => $val ) { |
|
| 144 | $query_param = str_replace($this->get_join_model()->get_this_model_name().".","", $query_param); |
|
| 145 | $parsed_query[$query_param] = $val; |
|
| 146 | } |
|
| 147 | $cols_n_values = array_merge( $cols_n_values, $parsed_query ); |
|
| 148 | } |
|
| 149 | ||
| 150 | $existing_entry_in_join_table = $this->get_join_model()->delete( array($cols_n_values) ); |
|
| 151 | return $other_model_obj; |
|
| @@ 153-161 (lines=9) @@ | ||
| 150 | $join_model_name_field_to_other_model->get_name() => $other_model_obj->get_model()->get_this_model_name() ); |
|
| 151 | ||
| 152 | //if $where_query exists lets add them to the query_params. |
|
| 153 | if ( !empty( $extra_join_model_fields_n_values ) ) { |
|
| 154 | //make sure we strip any of the join model names from the $where_query cause we don't need that in here (why? because client code may have used the same conditionals for get_all_related which DOES need the join model name) |
|
| 155 | //make sure we strip THIS models name from the query param |
|
| 156 | foreach ( $extra_join_model_fields_n_values as $query_param => $val ) { |
|
| 157 | $query_param = str_replace($this->get_join_model()->get_this_model_name().".","", $query_param); |
|
| 158 | $parsed_query[$query_param] = $val; |
|
| 159 | } |
|
| 160 | $cols_n_values = array_merge( $cols_n_values, $parsed_query ); |
|
| 161 | } |
|
| 162 | ||
| 163 | $query_params = array( $cols_n_values ); |
|
| 164 | ||
| @@ 206-214 (lines=9) @@ | ||
| 203 | $join_model_name_field_to_other_model->get_name() => $other_model_obj->get_model()->get_this_model_name() ); |
|
| 204 | ||
| 205 | //if $where_query exists lets add them to the query_params. |
|
| 206 | if ( !empty( $where_query ) ) { |
|
| 207 | //make sure we strip any of the join model names from the $where_query cause we don't need that in here (why? because client code may have used the same conditionals for get_all_related which DOES need the join model name) |
|
| 208 | //make sure we strip THIS models name from the query param |
|
| 209 | foreach ( $where_query as $query_param => $val ) { |
|
| 210 | $query_param = str_replace($this->get_join_model()->get_this_model_name().".","", $query_param); |
|
| 211 | $parsed_query[$query_param] = $val; |
|
| 212 | } |
|
| 213 | $cols_n_values = array_merge( $cols_n_values, $parsed_query ); |
|
| 214 | } |
|
| 215 | ||
| 216 | $existing_entry_in_join_table = $this->get_join_model()->delete( array($cols_n_values) ); |
|
| 217 | return $other_model_obj; |
|