public function toStringArray($dirty_only = false)
    {
        $out = [];
        foreach (static::getProperties() as $property => $meta) {
            if (! isset($this->_data[$property])) {
                continue;
            }

            //if we only want the dirty props, stop here
            if ($dirty_only && ! isset($this->_dirty[$property])) {
                continue;
            }

            $type = $meta[self::KEY_TYPE];

            if ($this->_data[$property] instanceof Collection) {
                $out[$property] = [];
                foreach ($this->_data[$property] as $assoc_property) {
                    $out[$property][] = self::castToString($type, $assoc_property);
                }
            } else {
                $out[$property] = self::castToString($type, $this->_data[$property]);
            }
        }

        return $out;
    }
public function toStringArray($dirty_only = false)
    {
        $out = [];
        foreach (static::getProperties() as $property => $meta) {
            if (! isset($this->_data[$property])) {
                continue;
            }

            //if we only want the dirty props, stop here
            if ($dirty_only && ! isset($this->_dirty[$property])) {
                continue;
            }

            $type = $meta[self::KEY_TYPE];

            if ($this->_data[$property] instanceof Collection) {
                $out[$property] = [];
                foreach ($this->_data[$property] as $assoc_property) {
                    $out[$property][] = self::castToString($type, $assoc_property);
                }
            } else {
                $out[$property] = self::castToString($type, $this->_data[$property]);
            }
        }

        return $out;
    }
public function toStringArray ( $ dirty_only = false ) { $ out = [ ] ; foreach ( static :: getProperties ( ) as $ property => $ meta ) { if ( ! isset ( $ this -> _data [ $ property ] ) ) { continue ; } //if we only want the dirty props, stop here if ( $ dirty_only && ! isset ( $ this -> _dirty [ $ property ] ) ) { continue ; } $ type = $ meta [ self :: KEY_TYPE ] ; if ( $ this -> _data [ $ property ] instanceof Collection ) { $ out [ $ property ] = [ ] ; foreach ( $ this -> _data [ $ property ] as $ assoc_property ) { $ out [ $ property ] [ ] = self :: castToString ( $ type , $ assoc_property ) ; } } else { $ out [ $ property ] = self :: castToString ( $ type , $ this -> _data [ $ property ] ) ; } } return $ out ; }
Convert the object into an array, and any non-primitives to string.

@param mixed $dirty_only
@return array
Convert the object into an array and any non - primitives to string .