|
@@ 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 |
|
|
|
@@ 5654-5668 (lines=15) @@
|
| 5651 |
|
* @return EE_Base_Class |
| 5652 |
|
* @throws EE_Error |
| 5653 |
|
*/ |
| 5654 |
|
public function get_one_copy($model_object_or_attributes_array, $query_params = array()) |
| 5655 |
|
{ |
| 5656 |
|
if (! is_array($query_params)) { |
| 5657 |
|
EE_Error::doing_it_wrong('EEM_Base::get_one_copy', |
| 5658 |
|
sprintf(__('$query_params should be an array, you passed a variable of type %s', 'event_espresso'), |
| 5659 |
|
gettype($query_params)), '4.6.0'); |
| 5660 |
|
$query_params = array(); |
| 5661 |
|
} |
| 5662 |
|
$query_params['limit'] = 1; |
| 5663 |
|
$copies = $this->get_all_copies($model_object_or_attributes_array, $query_params); |
| 5664 |
|
if (is_array($copies)) { |
| 5665 |
|
return array_shift($copies); |
| 5666 |
|
} |
| 5667 |
|
return null; |
| 5668 |
|
} |
| 5669 |
|
|
| 5670 |
|
|
| 5671 |
|
|