@@ 1040-1052 (lines=13) @@ | ||
1037 | * @return EE_Base_Class|EE_Soft_Delete_Base_Class|NULL |
|
1038 | * @throws \EE_Error |
|
1039 | */ |
|
1040 | public function get_one($query_params = array()){ |
|
1041 | if( ! is_array( $query_params ) ){ |
|
1042 | 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' ); |
|
1043 | $query_params = array(); |
|
1044 | } |
|
1045 | $query_params['limit'] = 1; |
|
1046 | $items = $this->get_all($query_params); |
|
1047 | if(empty($items)){ |
|
1048 | return null; |
|
1049 | }else{ |
|
1050 | return array_shift($items); |
|
1051 | } |
|
1052 | } |
|
1053 | ||
1054 | ||
1055 | ||
@@ 4746-4758 (lines=13) @@ | ||
4743 | * @return EE_Base_Class |
|
4744 | * @throws \EE_Error |
|
4745 | */ |
|
4746 | public function get_one_copy($model_object_or_attributes_array,$query_params = array()){ |
|
4747 | if( ! is_array( $query_params ) ){ |
|
4748 | 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' ); |
|
4749 | $query_params = array(); |
|
4750 | } |
|
4751 | $query_params['limit'] = 1; |
|
4752 | $copies = $this->get_all_copies($model_object_or_attributes_array,$query_params); |
|
4753 | if(is_array($copies)){ |
|
4754 | return array_shift($copies); |
|
4755 | }else{ |
|
4756 | return null; |
|
4757 | } |
|
4758 | } |
|
4759 | ||
4760 | ||
4761 |