Newscoop\Entity\Attachment::setLanguage PHP Метод

setLanguage() публичный Метод

Sets the value of language.
public setLanguage ( Language $language ) : self
$language Language the language
Результат self
    public function setLanguage(\Newscoop\Entity\Language $language)
    {
        $this->language = $language;
        return $this;
    }

Usage Example

Пример #1
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;
 }