承接 mandarinmedien/mmmmediabundle 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mandarinmedien/mmmmediabundle

Composer 安装命令:

composer require mandarinmedien/mmmmediabundle

包简介

YAMB -> Yet another Media bundle

关键字:

README 文档

README

Append to app/AppKernel.php

...
    public function registerBundles()
    {
        $bundles = array(
            ...
            new MandarinMedien\MMMediaBundle\MMMediaBundle(),
            ...
            );
    ....
    }
...

Append to app/config/config.yml

...
imports:
    - { resource: '@MMMediaBundle/Resources/config/config.yml' }
...

Append to App/config/routing.yml

...
mm_media:
    resource: "@MMMediaBundle/Resources/config/routing.yml"
    prefix:   /mmmedia
...

Create web/media folder to store images

...
shell: mkdir PROJECT_ROOT/web/media
...

Use MMMediaBundle in your Entities

You need to use the MediaSortable Entity of this bundle to have sortable Media. For a collection of media, use an unidirectional manyToMany-association and for single media an unidirectional oneToOne. To avoid garbage in your database, make sure to set the orphanRemoval flag.

eg. yaml configuration for single media:

...
    oneToOne:
        titleImage:
            targetEntity: MandarinMedien\MMMediaBundle\Entity\MediaSortable
            cascade:
              - persist
              - remove
...

eg. yaml configuration for media collection:

...
    manyToMany:
        medias:
            targetEntity: MandarinMedien\MMMediaBundle\Entity\MediaSortable
            orderBy: { 'position': 'ASC' }
            joinColumn:
                name: media_sortable_id
                referencedColumnName: id
            cascade:
                - persist
                - remove
            orphanRemoval: true
...

Add all needed Assets to your layout

To make the MMMediaBundle-UploadWidget work properly you need to add the necessary CSS and the JS files. Your can just copy this part below or add @mmmedia_assets_css and @mmmedia_assets_js into your asset calls.

Twig-Example:

...
    {% stylesheets '@mmmedia_assets_css' %}
    <link rel="stylesheet" href="{{ asset_url }}" />
    {% endstylesheets %}

    {% javascripts '@mmmedia_assets_js' %}
    <script src="{{ asset_url }}"></script>
    {% endjavascripts %}
...

FormType Options

...

    $builder          
        ->add('medias', 'mmmedia_upload_collection', array(
            
            // optional: configure allowed filetypes by file-extensions 
            'allowed_filetypes' => array( 
                '.jpg', '.png', '.gif'
            )
            
        ));

...

统计信息

  • 总下载量: 191
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 3
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-01-28

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固