@@ 1228-1242 (lines=15) @@ | ||
1225 | * @return EE_Base_Class|EE_Soft_Delete_Base_Class|NULL |
|
1226 | * @throws EE_Error |
|
1227 | */ |
|
1228 | public function get_one($query_params = array()) |
|
1229 | { |
|
1230 | if (! is_array($query_params)) { |
|
1231 | EE_Error::doing_it_wrong('EEM_Base::get_one', |
|
1232 | sprintf(__('$query_params should be an array, you passed a variable of type %s', 'event_espresso'), |
|
1233 | gettype($query_params)), '4.6.0'); |
|
1234 | $query_params = array(); |
|
1235 | } |
|
1236 | $query_params['limit'] = 1; |
|
1237 | $items = $this->get_all($query_params); |
|
1238 | if (empty($items)) { |
|
1239 | return null; |
|
1240 | } |
|
1241 | return array_shift($items); |
|
1242 | } |
|
1243 | ||
1244 | ||
1245 | ||
@@ 5632-5646 (lines=15) @@ | ||
5629 | * @return EE_Base_Class |
|
5630 | * @throws EE_Error |
|
5631 | */ |
|
5632 | public function get_one_copy($model_object_or_attributes_array, $query_params = array()) |
|
5633 | { |
|
5634 | if (! is_array($query_params)) { |
|
5635 | EE_Error::doing_it_wrong('EEM_Base::get_one_copy', |
|
5636 | sprintf(__('$query_params should be an array, you passed a variable of type %s', 'event_espresso'), |
|
5637 | gettype($query_params)), '4.6.0'); |
|
5638 | $query_params = array(); |
|
5639 | } |
|
5640 | $query_params['limit'] = 1; |
|
5641 | $copies = $this->get_all_copies($model_object_or_attributes_array, $query_params); |
|
5642 | if (is_array($copies)) { |
|
5643 | return array_shift($copies); |
|
5644 | } |
|
5645 | return null; |
|
5646 | } |
|
5647 | ||
5648 | ||
5649 |