public function afterFind(Model $model, $results, $primary=false) {
        $alias = $model->alias;

        foreach ($results as $i => $data) {
            if (empty($data[$alias])) {
                continue;
            }

            foreach ($data[$alias] as $field => $value) {
                if (empty($this->settings[$alias][$field]) || !empty($value)) {
                    continue;
                }

                $attachment = $this->_settingsCallback($model, $this->settings[$alias][$field]);

                if ($attachment['defaultPath']) {
                    $results[$i][$alias][$attachment['dbColumn']] = $attachment['defaultPath'];
                }

                if ($attachment['transforms']) {
                    foreach ($attachment['transforms'] as $transform) {
                        if ($transform['defaultPath']) {
                            $results[$i][$alias][$transform['dbColumn']] = $transform['defaultPath'];
                        }
                    }
                }
            }
        }

        return $results;
    }
public function afterFind(Model $model, $results, $primary=false) {
        $alias = $model->alias;

        foreach ($results as $i => $data) {
            if (empty($data[$alias])) {
                continue;
            }

            foreach ($data[$alias] as $field => $value) {
                if (empty($this->settings[$alias][$field]) || !empty($value)) {
                    continue;
                }

                $attachment = $this->_settingsCallback($model, $this->settings[$alias][$field]);

                if ($attachment['defaultPath']) {
                    $results[$i][$alias][$attachment['dbColumn']] = $attachment['defaultPath'];
                }

                if ($attachment['transforms']) {
                    foreach ($attachment['transforms'] as $transform) {
                        if ($transform['defaultPath']) {
                            $results[$i][$alias][$transform['dbColumn']] = $transform['defaultPath'];
                        }
                    }
                }
            }
        }

        return $results;
    }
public function afterFind ( Model $ model , $ results , $ primary = false ) { $ alias = $ model -> alias ; foreach ( $ results as $ i => $ data ) { if ( empty ( $ data [ $ alias ] ) ) { continue ; } foreach ( $ data [ $ alias ] as $ field => $ value ) { if ( empty ( $ this -> settings [ $ alias ] [ $ field ] ) || ! empty ( $ value ) ) { continue ; } $ attachment = $ this -> _settingsCallback ( $ model , $ this -> settings [ $ alias ] [ $ field ] ) ; if ( $ attachment [ 'defaultPath' ] ) { $ results [ $ i ] [ $ alias ] [ $ attachment [ 'dbColumn' ] ] = $ attachment [ 'defaultPath' ] ; } if ( $ attachment [ 'transforms' ] ) { foreach ( $ attachment [ 'transforms' ] as $ transform ) { if ( $ transform [ 'defaultPath' ] ) { $ results [ $ i ] [ $ alias ] [ $ transform [ 'dbColumn' ] ] = $ transform [ 'defaultPath' ] ; } } } } } return $ results ; }
After a find, replace any empty fields with the default path.

@param Model $model
@param array $results
@param bool $primary
@return array
After a find replace any empty fields with the default path .