@@ 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 | ||
@@ 4674-4686 (lines=13) @@ | ||
4671 | * @return EE_Base_Class |
|
4672 | * @throws \EE_Error |
|
4673 | */ |
|
4674 | public function get_one_copy($model_object_or_attributes_array,$query_params = array()){ |
|
4675 | if( ! is_array( $query_params ) ){ |
|
4676 | 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' ); |
|
4677 | $query_params = array(); |
|
4678 | } |
|
4679 | $query_params['limit'] = 1; |
|
4680 | $copies = $this->get_all_copies($model_object_or_attributes_array,$query_params); |
|
4681 | if(is_array($copies)){ |
|
4682 | return array_shift($copies); |
|
4683 | }else{ |
|
4684 | return null; |
|
4685 | } |
|
4686 | } |
|
4687 | ||
4688 | ||
4689 |