|
@@ 1022-1034 (lines=13) @@
|
| 1019 |
|
* @return EE_Base_Class | NULL |
| 1020 |
|
* @throws \EE_Error |
| 1021 |
|
*/ |
| 1022 |
|
public function get_one($query_params = array()){ |
| 1023 |
|
if( ! is_array( $query_params ) ){ |
| 1024 |
|
EE_Error::doing_it_wrong('EEM_Base::get_one', sprintf( __( '$query_params should be an array, you passed a variable of type %s', 'event_espresso' ), gettype( $query_params ) ), '4.6.0' ); |
| 1025 |
|
$query_params = array(); |
| 1026 |
|
} |
| 1027 |
|
$query_params['limit'] = 1; |
| 1028 |
|
$items = $this->get_all($query_params); |
| 1029 |
|
if(empty($items)){ |
| 1030 |
|
return null; |
| 1031 |
|
}else{ |
| 1032 |
|
return array_shift($items); |
| 1033 |
|
} |
| 1034 |
|
} |
| 1035 |
|
|
| 1036 |
|
|
| 1037 |
|
|
|
@@ 4707-4719 (lines=13) @@
|
| 4704 |
|
* @return EE_Base_Class |
| 4705 |
|
* @throws \EE_Error |
| 4706 |
|
*/ |
| 4707 |
|
public function get_one_copy($model_object_or_attributes_array,$query_params = array()){ |
| 4708 |
|
if( ! is_array( $query_params ) ){ |
| 4709 |
|
EE_Error::doing_it_wrong('EEM_Base::get_one_copy', sprintf( __( '$query_params should be an array, you passed a variable of type %s', 'event_espresso' ), gettype( $query_params ) ), '4.6.0' ); |
| 4710 |
|
$query_params = array(); |
| 4711 |
|
} |
| 4712 |
|
$query_params['limit'] = 1; |
| 4713 |
|
$copies = $this->get_all_copies($model_object_or_attributes_array,$query_params); |
| 4714 |
|
if(is_array($copies)){ |
| 4715 |
|
return array_shift($copies); |
| 4716 |
|
}else{ |
| 4717 |
|
return null; |
| 4718 |
|
} |
| 4719 |
|
} |
| 4720 |
|
|
| 4721 |
|
|
| 4722 |
|
|