Sets the value of description.
public setDescription ( |
||
$description | the description | |
return | self |
public function it_should_update_attachment() { $filesystem = new Filesystem(); $newFileName = __DIR__ . '/../../assets/images/temp-image.jpg'; $filesystem->copy(__DIR__ . '/../../assets/images/picture.jpg', $newFileName); $uploadedFile = new UploadedFile($newFileName, 'temp-image.jpg', 'image/jpg', filesize($newFileName), null, true); $language = new Language(); $attachment = new Attachment(); $phraseId = 1; $description = new Translation($phraseId); $description->setLanguage($language); $description->setTranslationText('Description text'); $attachment->setDescription($description); $this->upload($uploadedFile, 'Test file - updated', $language, array(), $attachment); }
private function fillAttachment(Attachment $attachment, $attributes) { $user = $this->userService->getCurrentUser(); $attributes = array_merge(array('language' => null, 'name' => null, 'extension' => null, 'mimeType' => null, 'contentDisposition' => Attachment::CONTENT_DISPOSITION, 'httpCharset' => null, 'sizeInBytes' => null, 'description' => null, 'user' => null, 'updated' => new \DateTime(), 'source' => 'local', 'status' => 'unapproved'), $attributes); if ($user->hasPermission('AddFile') || $user->hasPermission('ChangeFile')) { $attributes['status'] = 'approved'; } if (!is_null($attributes['language'])) { $attachment->setLanguage($attributes['language']); } if (!is_null($attributes['description'])) { $attachment->setDescription($attributes['description']); } $attachment->setName($attributes['name'])->setExtension($attributes['extension'])->setMimeType($attributes['mimeType'])->setContentDisposition($attributes['contentDisposition'])->setHttpCharset($attributes['httpCharset'])->setSizeInBytes($attributes['sizeInBytes'])->setUser($attributes['user'])->setUpdated($attributes['updated'])->setSource($attributes['source'])->setStatus($attributes['status']); return $attachment; }