bentools/user-aware-command-bundle 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

bentools/user-aware-command-bundle

Composer 安装命令:

composer require bentools/user-aware-command-bundle

包简介

Provides a user value to Doctrine Entities that implements Gedmo Blameable when using Console commands.

README 文档

README

This Symfony bundle provides a user value to Doctrine Entities that implements Gedmo Blameable when using Console commands.

Installation

composer require bentools/user-aware-command-bundle

Then, enable the bundle into Symfony's AppKernel.php:

# app/AppKernel.php
class AppKernel extends Kernel
{
    public function registerBundles() 
    {
        // ...
        $bundles[] = new BenTools\UserAwareCommandBundle\UserAwareCommandBundle();
    }
}

Usage

The bundle just works out of the box, provided you already have the Blameable extension configured and working on your entities. Your console command just has to implement BenTools\UserAwareCommandBundle\Model\UserAwareInterface, which contains no method:

namespace AppBundle\Command;

use BenTools\UserAwareCommandBundle\Model\UserAwareInterface;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

class DoMyCommand extends Command implements UserAwareInterface 
{
    protected function execute(InputInterface $input, OutputInterface $output) {
	    // ...
	}
}

By default, the bundle will bind the System user to your createdBy / updatedBy properties.

You can change this user per command run with the --user option:

php bin/console do:mycommand --user Ben

Advanced configuration

# app/config.yml

user_aware_command:
    user_name: System # change default user
    option_name: user # change default command option
    option_shortcut: u # set option shortcut

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-08-02

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固