setName() public method

Sets the value of name.
public setName ( string $name ) : self
$name string the name
return self
 public function it_should_generate_attachment_url()
 {
     $attachment = new Attachment();
     $attachment->setName('testfile.pdf')->setId(34);
     $this->getAttachmentUrl($attachment);
 }
Exemplo n.º 2
0
 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;
 }