PHP Class Newscoop\Services\AttachmentService

Show file Open project: sourcefabric/newscoop

Public Methods

Method Description
__construct ( array $config, EntityManager $em, Router $router, UserService $userService )
addAttachmentToArticle ( Article $article, Attachment $attachment )
getAttachmentUrl ( $attachment )
getStorageLocation ( Attachment $attachment ) : string Get attachment storage location
getUnedited ( integer $userId ) : array Return the ids of the file not edited yet.
remove ( Attachment $attachment )
removeAttachmentFormArticle ( Article $article, Attachment $attachment )
upload ( Symfony\Component\HttpFoundation\File\UploadedFile $file, string $descriptionText, Language $language, array $attributes, Attachment $attachment = null ) : Attachment Upload new attachment

Private Methods

Method Description
fillAttachment ( Attachment $attachment, $attributes )
getFileName ( Attachment $attachment ) : string Get new attachment file name
getLevel1DirectoryName ( Attachment $attachment ) : string Get fist level directory name
getLevel2DirectoryName ( Attachment $attachment ) : string Get second level directory name
makeDirectories ( Attachment $attachment ) : string Make directories for attachments

Method Details

__construct() public method

public __construct ( array $config, EntityManager $em, Router $router, UserService $userService )
$config array
$em Doctrine\ORM\EntityManager
$router Symfony\Component\Routing\Router
$userService UserService

addAttachmentToArticle() public method

public addAttachmentToArticle ( Article $article, Attachment $attachment )
$article Newscoop\Entity\Article
$attachment Newscoop\Entity\Attachment

getAttachmentUrl() public method

public getAttachmentUrl ( $attachment )

getStorageLocation() public method

Get attachment storage location
public getStorageLocation ( Attachment $attachment ) : string
$attachment Newscoop\Entity\Attachment
return string

getUnedited() public method

Return the ids of the file not edited yet.
public getUnedited ( integer $userId ) : array
$userId integer User id
return array

remove() public method

public remove ( Attachment $attachment )
$attachment Newscoop\Entity\Attachment

removeAttachmentFormArticle() public method

public removeAttachmentFormArticle ( Article $article, Attachment $attachment )
$article Newscoop\Entity\Article
$attachment Newscoop\Entity\Attachment

upload() public method

Upload new attachment
public upload ( Symfony\Component\HttpFoundation\File\UploadedFile $file, string $descriptionText, Language $language, array $attributes, Attachment $attachment = null ) : Attachment
$file Symfony\Component\HttpFoundation\File\UploadedFile
$descriptionText string
$language Newscoop\Entity\Language
$attributes array
$attachment Newscoop\Entity\Attachment
return Newscoop\Entity\Attachment