How to return value from database with condition?

i have column with integer value, i would like to map those integer with name before returning the value in model. how can i do that?

for example status column




    0 => pending

    1 => success

    2 => failed

    3 => no response

    4 => error

    5 => unknown



what should i do in my model?


MODEL:


    const STATUS_PENDING= 0;

    const STATUS_SUCCESS= 1;

..


    public function getStatusOptions()

    {

        return array(

            self::STATUS_PENDING=> 'pending',

            self::STATUS_SUCCESS=> 'success',

..

        );

    }


FORM: (Dropdown with "pending/success/...")


    <?php $form = _BasicActiveForm::begin(); ?>


    <?= $form->field($model, 'status')

                    ->dropDownList(

                          $model->getStatusOptions(),       

                         ['prompt'=>'']    

                     ); ?>

    <?php _BasicActiveForm::end(); ?>