承接 zenside/sonata-image-bundle 相关项目开发

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

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

zenside/sonata-image-bundle

Composer 安装命令:

composer require zenside/sonata-image-bundle

包简介

Allow easy support for image upload in sonata forms with preview of current image in onetoone relation

README 文档

README

Allow to easyly add Image property to an entity to be included in Sonata Forms.

Installation

Add bundle with composer

composer require zenside/sonata-image-bundle

And reference it in AppKernel.php

new ZenSide\SonataImageBundle\ZenSideSonataImageBundle(),

Configuration

After downloaded and add to AppKernel the bundle, update your database to add Image entity

php app/console doctrine:schema:update --force

Then you can add relations to Image type in your entities

class Article {
    /**
     * @ORM\OneToOne(targetEntity="ZenSide\SonataImageBundle\Entity\Image", cascade={"persist"})
     * @ORM\JoinColumn(nullable=true, onDelete="set null")
     */
    private $image;
}

If you want to directly use it in a SonataAdmin class, just use the field with type 'sonata_type_admin' or 'sonata_type_model'

$form->add('logo', 'sonata_type_admin');

Important : if you use 'sonata_type_admin' to directly include input type file in your form, you have to add the following preUpdate and prePersist listeners in your Admin class.

Just copy the following lines in your Admin class :

public function prePersist($subject)
{
    ImageAdmin::manageEmbeddedImageAdmins($this, $subject);
}
public function preUpdate($subject)
{
    ImageAdmin::manageEmbeddedImageAdmins($this, $subject);
}

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: GPL-3.0
  • 更新时间: 2015-09-17

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固