public function resolve()
    {
        $this->file = (new $this->fileClass())
            ->setName(
                $this->physicalFile->getBasename()
            )
            // calculate original name (keep it for user data display)
            ->setOriginalName($this->originalName
                ?: $this->physicalFile->getBasename()
            )
            // calculate storage path (we only need path from config)
            ->setStorePath(str_replace(// trim base path
                realpath($this->storePath),
                '',
                str_replace(// trim filename
                    $this->physicalFile->getBasename(),
                    '',
                    $this->physicalFile->getRealpath()
                )
            ))
        ;

        $this->assertEntityIsValid($this->file, array('File', 'creation'));

        $this->fireEvent(
            FileEvents::FILE_CREATED,
            new FileEvent($this->file, $this)
        );

        return $this->file;
    }
public function resolve()
    {
        $this->file = (new $this->fileClass())
            ->setName(
                $this->physicalFile->getBasename()
            )
            // calculate original name (keep it for user data display)
            ->setOriginalName($this->originalName
                ?: $this->physicalFile->getBasename()
            )
            // calculate storage path (we only need path from config)
            ->setStorePath(str_replace(// trim base path
                realpath($this->storePath),
                '',
                str_replace(// trim filename
                    $this->physicalFile->getBasename(),
                    '',
                    $this->physicalFile->getRealpath()
                )
            ))
        ;

        $this->assertEntityIsValid($this->file, array('File', 'creation'));

        $this->fireEvent(
            FileEvents::FILE_CREATED,
            new FileEvent($this->file, $this)
        );

        return $this->file;
    }
public function resolve ( ) { $ this -> file = ( new $ this -> fileClass ( ) ) -> setName ( $ this -> physicalFile -> getBasename ( ) ) // calculate original name (keep it for user data display) -> setOriginalName ( $ this -> originalName ? : $ this -> physicalFile -> getBasename ( ) ) // calculate storage path (we only need path from config) -> setStorePath ( str_replace ( // trim base path realpath ( $ this -> storePath ) , '' , str_replace ( // trim filename $ this -> physicalFile -> getBasename ( ) , '' , $ this -> physicalFile -> getRealpath ( ) ) ) ) ; $ this -> assertEntityIsValid ( $ this -> file , array ( 'File' , 'creation' ) ) ; $ this -> fireEvent ( FileEvents :: FILE_CREATED , new FileEvent ( $ this -> file , $ this ) ) ; return $ this -> file ; }
File creation method.

@return File
File creation method .