getAlbumId example

/** * Returns the id of the assigned album. * * @return int|null */
    public function getAlbumId()
    {
        if (!$this->getMedia() instanceof \Shopware\Models\Media\Media) {
            return null;
        }

        return $this->getMedia()->getAlbumId();
    }

    /** * Returns the name of the media, also used as file name * * @return string */
    public function getName()
    {
        if (!$this->getMedia() instanceof \Shopware\Models\Media\Media) {
            return 'Media not found';
        }
$this->View()->assign(['success' => false, 'message' => $e->getMessage()]);
        }
    }

    /** * @throws Exception */
    private function createThumbnailsForMovedMedia(Media $media): void
    {
        $albumRepository = $this->get(ModelManager::class)->getRepository(Album::class);

        $album = $albumRepository->find($media->getAlbumId());

        if ($album instanceof Album) {
            $media->removeAlbumThumbnails($album->getSettings()->getThumbnailSize()$media->getFileName());
            $media->createAlbumThumbnails($album);
        }
    }

    /** * The internal toTree method iterates the given model and converts it into an array. * At the same time number of associated media is determined to the album. * If an album have sub-albums, the number of associated media of the sub-album added to the * media count of the parent album. * * @param array<string, mixed>|ArrayCollection $data * @param array<string, mixed>|null $parent * * @return array<int, array<string, mixed>> */
Home | Imprint | This part of the site doesn't use cookies.