@@ 1164-1178 (lines=15) @@ | ||
1161 | * @return EE_Base_Class|EE_Soft_Delete_Base_Class|NULL |
|
1162 | * @throws EE_Error |
|
1163 | */ |
|
1164 | public function get_one($query_params = array()) |
|
1165 | { |
|
1166 | if (! is_array($query_params)) { |
|
1167 | EE_Error::doing_it_wrong( |
|
1168 | 'EEM_Base::get_one', |
|
1169 | sprintf( |
|
1170 | __('$query_params should be an array, you passed a variable of type %s', 'event_espresso'), |
|
1171 | gettype($query_params) |
|
1172 | ), |
|
1173 | '4.6.0' |
|
1174 | ); |
|
1175 | $query_params = array(); |
|
1176 | } |
|
1177 | $query_params['limit'] = 1; |
|
1178 | $items = $this->get_all($query_params); |
|
1179 | if (empty($items)) { |
|
1180 | return null; |
|
1181 | } |
|
@@ 5870-5884 (lines=15) @@ | ||
5867 | * @return EE_Base_Class |
|
5868 | * @throws EE_Error |
|
5869 | */ |
|
5870 | public function get_one_copy($model_object_or_attributes_array, $query_params = array()) |
|
5871 | { |
|
5872 | if (! is_array($query_params)) { |
|
5873 | EE_Error::doing_it_wrong( |
|
5874 | 'EEM_Base::get_one_copy', |
|
5875 | sprintf( |
|
5876 | __('$query_params should be an array, you passed a variable of type %s', 'event_espresso'), |
|
5877 | gettype($query_params) |
|
5878 | ), |
|
5879 | '4.6.0' |
|
5880 | ); |
|
5881 | $query_params = array(); |
|
5882 | } |
|
5883 | $query_params['limit'] = 1; |
|
5884 | $copies = $this->get_all_copies($model_object_or_attributes_array, $query_params); |
|
5885 | if (is_array($copies)) { |
|
5886 | return array_shift($copies); |
|
5887 | } |