public function setRelated($model = null, $data = null, $id = null)
    {
        if (!empty($model) && !empty($data)) {
            if (!empty($id)) {
                if (!isset($this->data[$model]))
                    $this->data[$model] = array();
                if (!is_array($this->data[$model]))
                    $this->data[$model] = array_filter( array( $this->data[$model] ) );
                $this->data[$model][$id] = $data;
            } else
                $this->data[$model] = $data;
        }
    }
public function setRelated($model = null, $data = null, $id = null)
    {
        if (!empty($model) && !empty($data)) {
            if (!empty($id)) {
                if (!isset($this->data[$model]))
                    $this->data[$model] = array();
                if (!is_array($this->data[$model]))
                    $this->data[$model] = array_filter( array( $this->data[$model] ) );
                $this->data[$model][$id] = $data;
            } else
                $this->data[$model] = $data;
        }
    }
public function setRelated ( $ model = null , $ data = null , $ id = null ) { if ( ! empty ( $ model ) && ! empty ( $ data ) ) { if ( ! empty ( $ id ) ) { if ( ! isset ( $ this -> data [ $ model ] ) ) $ this -> data [ $ model ] = array ( ) ; if ( ! is_array ( $ this -> data [ $ model ] ) ) $ this -> data [ $ model ] = array_filter ( array ( $ this -> data [ $ model ] ) ) ; $ this -> data [ $ model ] [ $ id ] = $ data ; } else $ this -> data [ $ model ] = $ data ; } }
Sets one of the object related object

@param string $model The name of the related model
@param array $data An array of the contents of the related object
@param int $id The related object primary ID in case of multi-relations
Sets one of the object related object