class Document extends AbstractDateTimed (View source)

Documents entity represent a file on server with datetime and naming.

Properties

protected $id from AbstractEntity
protected DateTime $createdAt from AbstractDateTimed
protected DateTime $updatedAt from AbstractDateTimed
static array $mimeToIcon Associate mime type to simple types.
protected $rawDocument
protected $raw
protected $embedId
protected $embedPlatform
protected ArrayCollection $nodesSourcesByFields
protected $folders
protected ArrayCollection $documentTranslations

Methods

int
getId()

No description

setId(int $id)

No description

getCreatedAt()

No description

setCreatedAt(DateTime $createdAt)

No description

getUpdatedAt()

No description

setUpdatedAt(DateTime $updatedAt)

No description

preUpdate()

No description

prePersist()

No description

resetDates()

Set creation and update date to now.

string
getFilename()

No description

$this
setFilename(string $filename)

No description

string
getMimeType()

No description

$this
setMimeType(string $mimeType)

No description

string
getShortType()

Get short type name for current document Mime type.

string
getShortMimeType()

Get short Mime type.

boolean
isImage()

Is current document an image.

boolean
isSvg()

Is current document a vector SVG file.

boolean
isVideo()

Is current document a video.

boolean
isAudio()

Is current document an audio file.

bool
isPdf()

Is current document a PDF file.

string
getFolder()

No description

$this
setFolder($folder)

Set folder name.

string
getRelativeUrl()

No description

string
getAbsolutePath() deprecated

Return absolute file path according to its privacy status.

string|null
getPublicAbsolutePath() deprecated

Only return public absolute file path.

string|null
getPrivateAbsolutePath() deprecated

Only return private absolute file path.

string
getEmbedId()

No description

$this
setEmbedId(string $embedId)

No description

string
getEmbedPlatform()

No description

$this
setEmbedPlatform(string $embedPlatform)

No description

boolean
isEmbed()

Tells if current document has embed media informations.

boolean
isPrivate()

No description

$this
setPrivate(boolean $private)

No description

getViewer()

No description

getHandler()

No description

ArrayCollection
getNodesSourcesByFields()

No description

ArrayCollection
getFolders()

No description

$this
addFolder(Folder $folder)

No description

ArrayCollection
getDocumentTranslations()

No description

Collection
getDocumentTranslationsByTranslation(Translation $translation)

No description

$this
addDocumentTranslation(DocumentTranslation $documentTranslation)

No description

bool
hasTranslations()

No description

__construct()

Create a new Document.

static string
getFilesFolder() deprecated

No description

static string
getFilesFolderName() deprecated

No description

static string
getPrivateFilesFolder() deprecated

No description

static string
getPrivateFilesFolderName() deprecated

No description

Document|null
getRawDocument()

Gets the value of rawDocument.

setRawDocument(Document $rawDocument = null)

Sets the value of rawDocument.

boolean
isRaw()

Is document a raw one.

setRaw(boolean $raw)

Sets the value of raw.

bool
fileExists() deprecated

No description

Document|null
getDownscaledDocument()

Gets the downscaledDocument.

string|null
getOrientation() deprecated

Get image orientation.

array|null
getImageSize() deprecated

No description

float|null
getImageSizeRatio() deprecated

No description

__clone()

Clone current document.

Details

int getId()

Return Value

int

AbstractEntity setId(int $id)

Parameters

int $id

Return Value

AbstractEntity

DateTime getCreatedAt()

Return Value

DateTime

AbstractEntity setCreatedAt(DateTime $createdAt)

Parameters

DateTime $createdAt

Return Value

AbstractEntity

DateTime getUpdatedAt()

Return Value

DateTime

AbstractEntity setUpdatedAt(DateTime $updatedAt)

Parameters

DateTime $updatedAt

Return Value

AbstractEntity

preUpdate()

prePersist()

AbstractEntity resetDates()

Set creation and update date to now.

Return Value

AbstractEntity

string getFilename()

Return Value

string

$this setFilename(string $filename)

Parameters

string $filename

Return Value

$this

string getMimeType()

Return Value

string

$this setMimeType(string $mimeType)

Parameters

string $mimeType

Return Value

$this

string getShortType()

Get short type name for current document Mime type.

Return Value

string

string getShortMimeType()

Get short Mime type.

Return Value

string

boolean isImage()

Is current document an image.

Return Value

boolean

boolean isSvg()

Is current document a vector SVG file.

Return Value

boolean

boolean isVideo()

Is current document a video.

Return Value

boolean

boolean isAudio()

Is current document an audio file.

Return Value

boolean

bool isPdf()

Is current document a PDF file.

Return Value

bool

string getFolder()

Return Value

string

$this setFolder($folder)

Set folder name.

Parameters

$folder

Return Value

$this

string getRelativeUrl()

Return Value

string

string getAbsolutePath() deprecated

deprecated Use Packages::getDocumentFilePath() method instead. Will be removed in Standard Edition.

Return absolute file path according to its privacy status.

Return Value

string

string|null getPublicAbsolutePath() deprecated

deprecated Use Assets package service instead. Will be removed in Standard Edition.

Only return public absolute file path.

Return Value

string|null

string|null getPrivateAbsolutePath() deprecated

deprecated Use Assets package service instead. Will be removed in Standard Edition.

Only return private absolute file path.

Return Value

string|null

string getEmbedId()

Return Value

string

$this setEmbedId(string $embedId)

Parameters

string $embedId

Return Value

$this

string getEmbedPlatform()

Return Value

string

$this setEmbedPlatform(string $embedPlatform)

Parameters

string $embedPlatform

Return Value

$this

boolean isEmbed()

Tells if current document has embed media informations.

Return Value

boolean

boolean isPrivate()

Return Value

boolean

$this setPrivate(boolean $private)

Parameters

boolean $private

Return Value

$this

DocumentViewer getViewer()

Return Value

DocumentViewer

DocumentHandler getHandler()

Return Value

DocumentHandler

ArrayCollection getNodesSourcesByFields()

Return Value

ArrayCollection

ArrayCollection getFolders()

Return Value

ArrayCollection

$this addFolder(Folder $folder)

Parameters

Folder $folder

Return Value

$this

ArrayCollection getDocumentTranslations()

Return Value

ArrayCollection

Collection getDocumentTranslationsByTranslation(Translation $translation)

Parameters

Translation $translation

Return Value

Collection

$this addDocumentTranslation(DocumentTranslation $documentTranslation)

Parameters

DocumentTranslation $documentTranslation

Return Value

$this

bool hasTranslations()

Return Value

bool

__construct()

Create a new Document.

static string getFilesFolder() deprecated

deprecated Use Kernel::getPublicFilesPath() whenever it’s possible. This will be removed in Standard Edition.

Return Value

string Return absolute path to public files.

static string getFilesFolderName() deprecated

deprecated Use Kernel::getPublicFilesBasePath() whenever it’s possible. This will be removed in Standard Edition.

Return Value

string

static string getPrivateFilesFolder() deprecated

deprecated Use Kernel::getPrivateFilesPath() whenever it’s possible. This will be removed in Standard Edition.

Return Value

string Return absolute path to private files. This path should be protected.

static string getPrivateFilesFolderName() deprecated

deprecated Use Kernel::getPrivateFilesBasePath() whenever it’s possible. This will be removed in Standard Edition.

Return Value

string

Document|null getRawDocument()

Gets the value of rawDocument.

Return Value

Document|null

Document setRawDocument(Document $rawDocument = null)

Sets the value of rawDocument.

Parameters

Document $rawDocument the raw document

Return Value

Document

boolean isRaw()

Is document a raw one.

Return Value

boolean

Document setRaw(boolean $raw)

Sets the value of raw.

Parameters

boolean $raw the raw

Return Value

Document

bool fileExists() deprecated

deprecated Use Packages methods to manage documents server paths. This will be removed in Standard Edition.

Return Value

bool

Document|null getDownscaledDocument()

Gets the downscaledDocument.

Return Value

Document|null

string|null getOrientation() deprecated

deprecated Use Twig filter "imageOrientation" instead. This will be removed in Standard Edition.

Get image orientation.

  • Return null if document is not an Image
  • Return 'landscape' if width is higher or equal to height
  • Return 'portrait' if height is strictly lower to width

Return Value

string|null

array|null getImageSize() deprecated

deprecated Use Twig filter "imageSize" instead. This will be removed in Standard Edition.

Return Value

array|null

float|null getImageSizeRatio() deprecated

deprecated Use Twig filter "imageRatio" instead. This will be removed in Standard Edition.

Return Value

float|null

__clone()

Clone current document.