How can I overwrite getter function of property of active record class?

I have this code:


     * @inheritdoc


    public function getAttribute($name)


        if ($name == 'languages') {

            $this->languages = ConvertArray::toPHPArray($this->languages)[0];


        return parent::getAttribute($name);


But this is not overwrite the 'language’s getter method.

I want to achieve that when this ‘language’ property called in the view then get the proper value…

 <?= $form->field($advertiser, 'languages')->checkboxList(LangaugeComponent::languages()) ?>

Because I have to convert the postgres array to php array…

In the construct, init method or using run-time property, these do not work(throws exceptions) also in the [b]__get/b in this getAttribute does not work too.