承接 baskin/history-bundle 相关项目开发

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

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

baskin/history-bundle

最新稳定版本:v2.0.1

Composer 安装命令:

composer require baskin/history-bundle

包简介

Twig Extension for Gedmo Loggable

README 文档

README

SensioLabsInsight

knpbundles.com

Twig Extension for DoctrineExtensions Loggable. StofDoctrineExtensionsBundle allows to easily use DoctrineExtensions in your Symfony project by configuring it through a ListenerManager and the DIC.

Setting up the bundle

Add BaskinHistoryBundle to your project

composer require baskin/history-bundle

Enable the Bundle

// app/AppKernel.php
public function registerBundles()
{
    $bundles = array(
        // ...
        new Baskin\HistoryBundle\BaskinHistoryBundle(),
    );
}

Configuration Reference

Below is the full default configuration for the bundle:

# app/config/config.yml
baskin_history:
  revert: false # change if you want to revert function
  versionParameter: version # Query parameter for revert function ex: /route?version=12
  template: BaskinHistoryBundle:History:history.html.twig #history log template

The reference can be dumped using the following command: php app/console config:dump-reference BaskinHistoryBundle

Usage

Simple twig function with your loggable entity parameter.

{{ getLogs(entity) }}

Revert Function Usage

Firstly revert configuration must be enabled. And use reverter service revert method on controller method.`

$entity = $em->getRepository('AppBundle:YourEntity')->find($id);

$this->get('reverter')->revert($entity);  

Usage with SensioFrameworkExtraBundle ParamConverter

Basically it is automatically convert your entity. If you want to disable you must set revertable options to false.

/**
 * @ParamConverter("yourEntity", options={"revertable" = false})
 */
public function showAction(YourEntity $yourEntity)
{
    ...
}  

Note : If you don't want to show Show this version button set second parameter false {{ getLogs(entity, false) }}

统计信息

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

GitHub 信息

  • Stars: 5
  • Watchers: 2
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-10-29