src/Model/Behavior/UploadBehavior.php
public function beforeMarshal(Event $event, ArrayObject $data, ArrayObject $options)
    {
        $validator = $this->_table->getValidator();
        $dataArray = $data->getArrayCopy();
        foreach (array_keys($this->getConfig(null, [])) as $field) {
            if (!$validator->isEmptyAllowed($field, false)) {
                continue;
            }
            if (Hash::get($dataArray, $field . '.error') !== UPLOAD_ERR_NO_FILE) {
                continue;
            }
            unset($data[$field]);
        }
    }
public function beforeMarshal(Event $event, ArrayObject $data, ArrayObject $options)
    {
        $validator = $this->_table->getValidator();
        $dataArray = $data->getArrayCopy();
        foreach (array_keys($this->getConfig(null, [])) as $field) {
            if (!$validator->isEmptyAllowed($field, false)) {
                continue;
            }
            if (Hash::get($dataArray, $field . '.error') !== UPLOAD_ERR_NO_FILE) {
                continue;
            }
            unset($data[$field]);
        }
    }
public function beforeMarshal ( Event $ event , ArrayObject $ data , ArrayObject $ options ) { $ validator = $ this -> _table -> getValidator ( ) ; $ dataArray = $ data -> getArrayCopy ( ) ; foreach ( array_keys ( $ this -> getConfig ( null , [ ] ) ) as $ field ) { if ( ! $ validator -> isEmptyAllowed ( $ field , false ) ) { continue ; } if ( Hash :: get ( $ dataArray , $ field . '.error' ) !== UPLOAD_ERR_NO_FILE ) { continue ; } unset ( $ data [ $ field ] ) ; } }
Modifies the data being marshalled to ensure invalid upload data is not inserted

@param \Cake\Event\Event $event an event instance
@param \ArrayObject $data data being marshalled
@param \ArrayObject $options options for the current event
@return void
Modifies the data being marshalled to ensure invalid upload data is not inserted