original_string: public function scheduleForUpload($value, $entity, $field)
      {
          if (is_string($value)) {
              // try to locate the file on disk
              $value = new FixtureFile($this->fileManager->getFilePath($entity, $field, $value));
          }
  
          if ($value instanceof File) {
              $replaceFile = isset($value->metaData['keep_previous_filename']) and $value->metaData['keep_previous_filename'];
              $path = $this->fileManager->prepare($value, $entity, $field, !$replaceFile);
              $fileName = basename($path);
              PropertyHelper::setValue($entity, $field, $fileName);
              $this->unitOfWork[spl_object_hash($entity)][$field]['save'] = function ($fm) use ($value, $path) {
                  $fm->save($value, $path);
              };
              return $fileName;
          } else {
              throw new \InvalidArgumentException("Invalid argument to scheduleForUpload(): " . gettype($value));
          }
      }
code: public function scheduleForUpload($value, $entity, $field)
      {
          if (is_string($value)) {
              // try to locate the file on disk
              $value = new FixtureFile($this->fileManager->getFilePath($entity, $field, $value));
          }
  
          if ($value instanceof File) {
              $replaceFile = isset($value->metaData['keep_previous_filename']) and $value->metaData['keep_previous_filename'];
              $path = $this->fileManager->prepare($value, $entity, $field, !$replaceFile);
              $fileName = basename($path);
              PropertyHelper::setValue($entity, $field, $fileName);
              $this->unitOfWork[spl_object_hash($entity)][$field]['save'] = function ($fm) use ($value, $path) {
                  $fm->save($value, $path);
              };
              return $fileName;
          } else {
              throw new \InvalidArgumentException("Invalid argument to scheduleForUpload(): " . gettype($value));
          }
      }
code_tokens: public function scheduleForUpload ( $ value , $ entity , $ field ) { if ( is_string ( $ value ) ) { // try to locate the file on disk $ value = new FixtureFile ( $ this -> fileManager -> getFilePath ( $ entity , $ field , $ value ) ) ; } if ( $ value instanceof File ) { $ replaceFile = isset ( $ value -> metaData [ 'keep_previous_filename' ] ) and $ value -> metaData [ 'keep_previous_filename' ] ; $ path = $ this -> fileManager -> prepare ( $ value , $ entity , $ field , ! $ replaceFile ) ; $ fileName = basename ( $ path ) ; PropertyHelper :: setValue ( $ entity , $ field , $ fileName ) ; $ this -> unitOfWork [ spl_object_hash ( $ entity ) ] [ $ field ] [ 'save' ] = function ( $ fm ) use ( $ value , $ path ) { $ fm -> save ( $ value , $ path ) ; } ; return $ fileName ; } else { throw new \ InvalidArgumentException ( "Invalid argument to scheduleForUpload(): " . gettype ( $ value ) ) ; } }
docstring: Puts the upload in the unit of work to be executed when the flush is done.
  
  @param mixed $value
  @param mixed $entity
  @param string $field
  @return string
  
  @throws \InvalidArgumentException
docstring_tokens: Puts the upload in the unit of work to be executed when the flush is done .