Skip to content

Schibsted-Tech-Polska/stp.svd-media-bundle

Repository files navigation

SvD Media Bundle

Configuration

svd_media:
    adapter:                            gaufrette_service_id
    base_url:                           file_folder_url

Usage

Add ralation to your entity annotation.

/**
* @OneToOne(targetEntity="File")
* @JoinColumn(name="file_id", referencedColumnName="id")
**/
protected $file; 

To form type add media field

public function buildForm(FormBuilderInterface $builder, array $options)
{
    $builder->add('file', MediaType::class)
}

To remove unused media from storage, run command:

app/console media:remove-unused