We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 18373 ☆ A M B ☆
    • 3,141 Posts
    I'd recommend using beforeSet in the create/update processors as well, and slightly rewrite it to..

        public function beforeSet(){
            $from_name = trim($this->getProperty('msg_from_name'));
            $from_addr = trim($this->getProperty('msg_from_addr'));
            $from = !empty($from_name) ? $from_addr.'|'.$from_name : $from_addr ;
             
            $reply_name = trim($this->getProperty('msg_reply_name'));
            $reply_addr = trim($this->getProperty('msg_reply_addr'));
            $replyto = !empty($reply_name) ? $reply_addr.'|'.$reply_name : $reply_addr ;
     
            $this->setProperty('msg_from',$from);
            $this->setProperty('msg_replyto',$replyto);
             
            $this->unsetProperty('msg_from_name');
            $this->unsetProperty('msg_from_addr');
            $this->unsetProperty('msg_reply_name');
            $this->unsetProperty('msg_reply_addr');
             
            return parent::beforeSet();
        }


    but that's not more than semantics.

    One thing I'm not certain of is whether I'm using unsetProperty() on the correct object ... but I don't seem to be getting any db errors.
    xPDO is smart enough to look at the table schema before adding non-existant fields to the generated SQL query.
      Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

      Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.