@@ 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 | ||
@@ 4684-4696 (lines=13) @@ | ||
4681 | * @return EE_Base_Class |
|
4682 | * @throws \EE_Error |
|
4683 | */ |
|
4684 | public function get_one_copy($model_object_or_attributes_array,$query_params = array()){ |
|
4685 | if( ! is_array( $query_params ) ){ |
|
4686 | 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' ); |
|
4687 | $query_params = array(); |
|
4688 | } |
|
4689 | $query_params['limit'] = 1; |
|
4690 | $copies = $this->get_all_copies($model_object_or_attributes_array,$query_params); |
|
4691 | if(is_array($copies)){ |
|
4692 | return array_shift($copies); |
|
4693 | }else{ |
|
4694 | return null; |
|
4695 | } |
|
4696 | } |
|
4697 | ||
4698 | ||
4699 |