|
@@ 1243-1257 (lines=15) @@
|
| 1240 |
|
* @return EE_Base_Class|EE_Soft_Delete_Base_Class|NULL |
| 1241 |
|
* @throws EE_Error |
| 1242 |
|
*/ |
| 1243 |
|
public function get_one($query_params = array()) |
| 1244 |
|
{ |
| 1245 |
|
if (! is_array($query_params)) { |
| 1246 |
|
EE_Error::doing_it_wrong('EEM_Base::get_one', |
| 1247 |
|
sprintf(__('$query_params should be an array, you passed a variable of type %s', 'event_espresso'), |
| 1248 |
|
gettype($query_params)), '4.6.0'); |
| 1249 |
|
$query_params = array(); |
| 1250 |
|
} |
| 1251 |
|
$query_params['limit'] = 1; |
| 1252 |
|
$items = $this->get_all($query_params); |
| 1253 |
|
if (empty($items)) { |
| 1254 |
|
return null; |
| 1255 |
|
} |
| 1256 |
|
return array_shift($items); |
| 1257 |
|
} |
| 1258 |
|
|
| 1259 |
|
|
| 1260 |
|
|
|
@@ 5790-5804 (lines=15) @@
|
| 5787 |
|
* @return EE_Base_Class |
| 5788 |
|
* @throws EE_Error |
| 5789 |
|
*/ |
| 5790 |
|
public function get_one_copy($model_object_or_attributes_array, $query_params = array()) |
| 5791 |
|
{ |
| 5792 |
|
if (! is_array($query_params)) { |
| 5793 |
|
EE_Error::doing_it_wrong('EEM_Base::get_one_copy', |
| 5794 |
|
sprintf(__('$query_params should be an array, you passed a variable of type %s', 'event_espresso'), |
| 5795 |
|
gettype($query_params)), '4.6.0'); |
| 5796 |
|
$query_params = array(); |
| 5797 |
|
} |
| 5798 |
|
$query_params['limit'] = 1; |
| 5799 |
|
$copies = $this->get_all_copies($model_object_or_attributes_array, $query_params); |
| 5800 |
|
if (is_array($copies)) { |
| 5801 |
|
return array_shift($copies); |
| 5802 |
|
} |
| 5803 |
|
return null; |
| 5804 |
|
} |
| 5805 |
|
|
| 5806 |
|
|
| 5807 |
|
|