@@ 912-924 (lines=13) @@ | ||
909 | * @param array $query_params like EEM_Base's $query_params variable. |
|
910 | * @return EE_Base_Class | NULL |
|
911 | */ |
|
912 | function get_one($query_params = array()){ |
|
913 | if( ! is_array( $query_params ) ){ |
|
914 | 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' ); |
|
915 | $query_params = array(); |
|
916 | } |
|
917 | $query_params['limit'] = 1; |
|
918 | $items = $this->get_all($query_params); |
|
919 | if(empty($items)){ |
|
920 | return null; |
|
921 | }else{ |
|
922 | return array_shift($items); |
|
923 | } |
|
924 | } |
|
925 | ||
926 | ||
927 | ||
@@ 4197-4209 (lines=13) @@ | ||
4194 | * @param array $query_params |
|
4195 | * @return EE_Base_Class |
|
4196 | */ |
|
4197 | function get_one_copy($model_object_or_attributes_array,$query_params = array()){ |
|
4198 | if( ! is_array( $query_params ) ){ |
|
4199 | 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' ); |
|
4200 | $query_params = array(); |
|
4201 | } |
|
4202 | $query_params['limit'] = 1; |
|
4203 | $copies = $this->get_all_copies($model_object_or_attributes_array,$query_params); |
|
4204 | if(is_array($copies)){ |
|
4205 | return array_shift($copies); |
|
4206 | }else{ |
|
4207 | return null; |
|
4208 | } |
|
4209 | } |
|
4210 | ||
4211 | ||
4212 |