Set gallery

@param \Amulen\MediaBundle\Entity\Gallery $gallery
@return \Amulen\MediaBundle\Entity\Gallery
358921
public function setGallery(\Amulen\MediaBundle\Entity\Gallery $gallery = null)
    {
        $this->gallery = $gallery;

        return $this;
    }
1199684
public function update(GalleryRequest $request, Gallery $gallery)
    {
        try {
            $attributes = $request->all();

            $gallery->update($attributes);
            return $this->response->message(trans('messages.success.updated', ['Module' => trans('gallery::gallery.name')]))
                ->code(204)
                ->status('success')
                ->url(guard_url('gallery/gallery/' . $gallery->getRouteKey()))
                ->redirect();
        } catch (Exception $e) {
            return $this->response->message($e->getMessage())
                ->code(400)
                ->status('error')
                ->url(guard_url('gallery/gallery/' . $gallery->getRouteKey()))
                ->redirect();
        }

    }
1345199
public function gallery( $html = true ) {
		if ( isset($this->custom['gallery']) ) {
			return $this->custom['gallery'];
		}
		$galleries = get_post_galleries($this->ID, $html);
		$gallery = reset($galleries);

		return apply_filters('get_post_gallery', $gallery, $this->ID, $galleries);
	}
67650
public function setAssets($assets): self
    {
        if (is_array($assets)) {
            $assets = new \ArrayIterator($assets);
        }
        if (!$assets instanceof \Traversable) {
            throw new \InvalidArgumentException('Assets must be an iterable array or object.');
        }
        $this->assets = $assets;

        return $this;
    }
1332937
public function setSelf($self)
    {
        $this->_links[self::SELF][self::HREF] = $self;
        $this->removeEmptyLinks();

        return $this;
    }
1140395
public function setCategory(\Amulen\ClassificationBundle\Entity\Category $category = null)
    {
        $this->category = $category;

        return $this;
    }
1257379
public function newAction()
    {
        $entity = new GalleryItem();
        $form   = $this->createCreateForm($entity);

        return array(
            'entity' => $entity,
            'form'   => $form->createView(),
        );
    }
710945
public function setCategories($categories)
    {
        foreach ($categories as $category) {
            $category->setBlog($this);
        }
        $this->categories = $categories;

        return $this;
    }
69263
public function setImage(\Core\Entity\Image $image = null) {
        $this->image = $image;

        return $this;
    }
920884
public function setSpecies(\Librinfo\VarietiesBundle\Entity\Species $species = null)
    {
        $this->species = $species;

        return $this;
    }
539287
public function setCategory($category)
    {
        $properties = $this->getProperty();
        $properties['category'] = (array) $category;
        $this->getConfig()->setSection('bundle', $properties, true);

        return $this;
    }
671288
public function setLanguage($lang)
	{
		$this->lang     = $lang;
		$this->metadata = $this->getMetadata($this->lang);

		return $this;
	}
1056870
public function setDir($dir) {
        if (false === in_array($dir, DataTablesEnumerator::enumDirs())) {
            $dir = self::DATATABLES_DIR_ASC;
        }
        $this->dir = strtoupper($dir);
        return $this;
    }
1112254
public function addGalleryItem(\Amulen\MediaBundle\Entity\GalleryItem $galleryItems) {
        $galleryItems->setGallery($this);
        $this->galleryItems[] = $galleryItems;

        return $this;
    }
1129994
public function setItems(array $value) {
    if (isset($value[0]) &&
        is_object($value[0]) &&
        !$value[0] instanceof GalleryItem
    ) {
      $this->triggerError('Object not of type GalleryItem');
    }
    else {
      $this->items = $value;
    }
    return $this;
  }
945626
public function setLayout( Layout $layout = null )
    {
        if ( null === $layout )
        {
            $this->layoutId = null;
            $this->_layout  = null;
        }
        else
        {
            $this->layoutId = $layout->id;
            $this->_layout  = $layout;
        }

        return $this;
    }
299563
public function createItem( $gallery, $item, $type = null ) {

		$modelFile = Yii::$app->factory->get( 'modelFileService' )->getModelObject();

		// Save Gallery Image
		$this->fileService->saveImage( $item, [ 'model' => $modelFile, 'attribute' => 'modelId' ] );

		// Save Gallery Item
		if( $item->id > 0 ) {

			if( empty( $type ) ) {

				$type = CoreGlobal::TYPE_DEFAULT;
			}

			$modelFile->parentType	= static::$parentType;
			$modelFile->parentId	= $gallery->id;
			$modelFile->type		= $type;

			$modelFile->save();
		}

		return $modelFile;
	}