public function beforeValidate($event) { $instance = $this->getUploadedFileInstance(); if ($this->checkScenario() && $instance) { $this->getOwner()->{$this->attributeName} = $instance; } }