定制 psamatt/yaml-export-bundle 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

psamatt/yaml-export-bundle

Composer 安装命令:

composer require psamatt/yaml-export-bundle

包简介

Yaml Exporter for use with Symfony2

README 文档

README

Build Status

Symfony2 bundle to export database records into YAML format using a Symfony2 Command.

This bundle allows you to export specific database records into YAML format enabling DBUnit testing on your repositories functions. This can be used as a very generic export of all rows such as SELECT * FROM table or you can create a very specific use case using powerful DQL (or native SQL) to export those rows that enable you to have a full test suite for your repository functions.

What you need

This bundle requires Symfony 2 (or greater) including Doctrine 2

Installation

Step 1: Download the YamlExportBundle using composer

Add YamlExportBundle in your composer.json:

{
    "require": {
        "psamatt/yaml-export-bundle": "dev-master"
    }
}

Now tell *composer to download the bundle by running the command:

$ php composer.phar update psamatt/yaml-export-bundle

Composer will install the bundle to your project's vendor/psamatt directory.

  • Note: If you don't have Composer yet, download it following the instructions on http://getcomposer.org/ or just run the following command:

curl -s https://getcomposer.org/installer | php

Step 2: Enable the bundle

Enable the bundle in the kernel:

<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new Psamatt\YamlExportBundle\PsamattYamlExportBundle(),
    );
}

Example usage

Using DQL and writing out to Terminal

php app/console psamatt:yaml-export:dump "SELECT * FROM AcmeStoreBundle:BlogPost"

Using DQL and storing output to a specified file

php app/console psamatt:yaml-export:dump "SELECT * FROM AcmeStoreBundle:BlogPost" "/path/to/file.yml"

Using DQL namespaced entity to a specified file

php app/console psamatt:yaml-export:dump "SELECT * FROM \Acme\StoreBundle\Entity\BlogPost" "/path/to/file.yml"

Using SQL and writing out to Terminal

php app/console psamatt:yaml-export:dump "SELECT * FROM blog_posts" --sql

Using SQL and storing output to a specified file

php app/console psamatt:yaml-export:dump "SELECT * FROM blog_posts" "/path/to/file.yml" --sql

** Then in your Unit Test file you need to specify the YAML file **

// ..
	public function getDataSet()
	{
		$dataSet = new \PHPUnit_Extensions_Database_DataSet_YamlDataSet(dirname(__FILE__) . "/_files/BlogPost/seed.yml");
		// .. Add further YAML files
		// $dataSet->addYamlFile(dirname(__FILE__) . "/_files/path/to/other/seed.yml");		
		return $dataSet;
	}
// ..

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2013-05-21

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固