PHP 클래스 Common\Doctrine\ValueObject\AbstractFile

You need to implement the method getUploadDir. When using this class in an entity certain life cycle callbacks should be called prepareToUpload for @ORM\PrePersist() and @ORM\PreUpdate() upload for @ORM\PostPersist() and @ORM\PostUpdate() remove for @ORM\PostRemove()
파일 보기 프로젝트 열기: forkcms/forkcms 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$file Symfony\Component\HttpFoundation\File\UploadedFile
$fileName string
$oldFileName string

공개 메소드들

메소드 설명
__toString ( ) : string Returns a string representation of the image.
fromString ( string $fileName ) : static
fromUploadedFile ( Symfony\Component\HttpFoundation\File\UploadedFile $uploadedFile = null ) : static
getAbsolutePath ( ) : string | null
getFile ( ) : Symfony\Component\HttpFoundation\File\UploadedFile Get file.
getFileName ( ) : string
getWebPath ( ) : string
markForDeletion ( ) The next time doctrine saves this to the database the file will be removed
prepareToUpload ( ) This function should be called for the life cycle events @ORM\PrePersist() and @ORM\PreUpdate()
remove ( ) This function should be called for the life cycle event @ORM\PostRemove()
setFile ( Symfony\Component\HttpFoundation\File\UploadedFile $file = null ) : static Sets file.
upload ( ) This function should be called for the life cycle events @ORM\PostPersist() and @ORM\PostUpdate()

보호된 메소드들

메소드 설명
__construct ( string $fileName )
getTrimmedUploadDir ( ) : string
getUploadDir ( ) : string The dir in the web folder where the file needs to be uploaded.
getUploadRootDir ( ) : string
removeOldFile ( ) This will remove the old file, can be extended to add extra functionality
writeFileToDisk ( ) if there is an error when moving the file, an exception will be automatically thrown by move(). This will properly prevent the entity from being persisted to the database on error

메소드 상세

__construct() 보호된 메소드

protected __construct ( string $fileName )
$fileName string

__toString() 공개 메소드

Returns a string representation of the image.
public __toString ( ) : string
리턴 string

fromString() 공개 정적인 메소드

public static fromString ( string $fileName ) : static
$fileName string
리턴 static

fromUploadedFile() 공개 정적인 메소드

public static fromUploadedFile ( Symfony\Component\HttpFoundation\File\UploadedFile $uploadedFile = null ) : static
$uploadedFile Symfony\Component\HttpFoundation\File\UploadedFile
리턴 static

getAbsolutePath() 공개 메소드

public getAbsolutePath ( ) : string | null
리턴 string | null

getFile() 공개 메소드

Get file.
public getFile ( ) : Symfony\Component\HttpFoundation\File\UploadedFile
리턴 Symfony\Component\HttpFoundation\File\UploadedFile

getFileName() 공개 메소드

public getFileName ( ) : string
리턴 string

getTrimmedUploadDir() 보호된 메소드

protected getTrimmedUploadDir ( ) : string
리턴 string

getUploadDir() 추상적인 보호된 메소드

The base directory is always the src/Frontend/Files/ directory
abstract protected getUploadDir ( ) : string
리턴 string

getUploadRootDir() 보호된 메소드

protected getUploadRootDir ( ) : string
리턴 string

getWebPath() 공개 메소드

public getWebPath ( ) : string
리턴 string

markForDeletion() 공개 메소드

The next time doctrine saves this to the database the file will be removed
public markForDeletion ( )

prepareToUpload() 공개 메소드

This function should be called for the life cycle events @ORM\PrePersist() and @ORM\PreUpdate()
public prepareToUpload ( )

remove() 공개 메소드

This function should be called for the life cycle event @ORM\PostRemove()
public remove ( )

removeOldFile() 보호된 메소드

This will remove the old file, can be extended to add extra functionality
protected removeOldFile ( )

setFile() 공개 메소드

Sets file.
public setFile ( Symfony\Component\HttpFoundation\File\UploadedFile $file = null ) : static
$file Symfony\Component\HttpFoundation\File\UploadedFile
리턴 static

upload() 공개 메소드

This function should be called for the life cycle events @ORM\PostPersist() and @ORM\PostUpdate()
public upload ( )

writeFileToDisk() 보호된 메소드

if there is an error when moving the file, an exception will be automatically thrown by move(). This will properly prevent the entity from being persisted to the database on error
protected writeFileToDisk ( )

프로퍼티 상세

$file 보호되어 있는 프로퍼티

protected UploadedFile,Symfony\Component\HttpFoundation\File $file
리턴 Symfony\Component\HttpFoundation\File\UploadedFile

$fileName 보호되어 있는 프로퍼티

protected string $fileName
리턴 string

$oldFileName 보호되어 있는 프로퍼티

protected string $oldFileName
리턴 string