mtv\models\Model::parse PHP Method

parse() public method

Process the raw data from permanent storage
public parse ( &$data )
    public function parse(&$data)
    {
        // Make sure we have an array and not an object
        if (is_object($data)) {
            return (array) $data;
        } else {
            return $data;
        }
    }

Usage Example

Beispiel #1
0
 public function parse(&$data)
 {
     // Use the parent parse
     $ret =& parent::parse($data);
     // figure out where the id is
     if (!empty($ret['userblog_id'])) {
         $ret['id'] =& $ret['userblog_id'];
         unset($ret['userblog_id']);
     } else {
         if (!empty($ret['blog_id'])) {
             $ret['id'] =& $ret['blog_id'];
             unset($ret['blog_id']);
         }
     }
     return $ret;
 }