public function afterUpdate()
    {
        //only clean and change custom fields if they are been sent
        if (!empty($this->customFields)) {
            //replace old custom with new
            $allCustomFields = $this->getAllCustomFields();
            if (is_array($allCustomFields)) {
                foreach ($this->customFields as $key => $value) {
                    $allCustomFields[$key] = $value;
                }
            }

            //set
            $this->setCustomFields($allCustomFields);
            //clean old
            $this->cleanCustomFields($this->getId());
            //save new
            $this->saveCustomFields();
        }
    }
public function afterUpdate()
    {
        //only clean and change custom fields if they are been sent
        if (!empty($this->customFields)) {
            //replace old custom with new
            $allCustomFields = $this->getAllCustomFields();
            if (is_array($allCustomFields)) {
                foreach ($this->customFields as $key => $value) {
                    $allCustomFields[$key] = $value;
                }
            }

            //set
            $this->setCustomFields($allCustomFields);
            //clean old
            $this->cleanCustomFields($this->getId());
            //save new
            $this->saveCustomFields();
        }
    }
public function afterUpdate ( ) { //only clean and change custom fields if they are been sent if ( ! empty ( $ this -> customFields ) ) { //replace old custom with new $ allCustomFields = $ this -> getAllCustomFields ( ) ; if ( is_array ( $ allCustomFields ) ) { foreach ( $ this -> customFields as $ key => $ value ) { $ allCustomFields [ $ key ] = $ value ; } } //set $ this -> setCustomFields ( $ allCustomFields ) ; //clean old $ this -> cleanCustomFields ( $ this -> getId ( ) ) ; //save new $ this -> saveCustomFields ( ) ; } }
After the model was update we need to update its custom fields

@return void
After the model was update we need to update its custom fields