@@ 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 | } |
|
@@ 5866-5880 (lines=15) @@ | ||
5863 | * @return EE_Base_Class |
|
5864 | * @throws EE_Error |
|
5865 | */ |
|
5866 | public function get_one_copy($model_object_or_attributes_array, $query_params = array()) |
|
5867 | { |
|
5868 | if (! is_array($query_params)) { |
|
5869 | EE_Error::doing_it_wrong( |
|
5870 | 'EEM_Base::get_one_copy', |
|
5871 | sprintf( |
|
5872 | __('$query_params should be an array, you passed a variable of type %s', 'event_espresso'), |
|
5873 | gettype($query_params) |
|
5874 | ), |
|
5875 | '4.6.0' |
|
5876 | ); |
|
5877 | $query_params = array(); |
|
5878 | } |
|
5879 | $query_params['limit'] = 1; |
|
5880 | $copies = $this->get_all_copies($model_object_or_attributes_array, $query_params); |
|
5881 | if (is_array($copies)) { |
|
5882 | return array_shift($copies); |
|
5883 | } |