getMediaGalleryMappingDefinition example

$this->configureRegistry([
            'Media' => $mediaDefinition = $this->getMediaDefinition([
                new ManyToManyAssociationField(
                    'galleries',
                    'MediaGallery',
                    'MediaGalleryMapping',
                    'media_id',
                    'gallery_id',
                ),
            ]),
            'MediaGallery' => $this->getMediaGalleryDefinition(),
            'MediaGalleryMapping' => $this->getMediaGalleryMappingDefinition(),
        ]);

        $id1 = Uuid::randomHex();
        $id2 = Uuid::randomHex();

        $media1 = $this->createMedia($id1);
        $media2 = $this->createMedia($id2);

        /** @var StaticEntityRepository<MediaCollection> $repo */
        $repo = new StaticEntityRepository(
            [
                
Home | Imprint | This part of the site doesn't use cookies.