承接 codeedu/zendexpr-doctrine-fixture 相关项目开发

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

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

codeedu/zendexpr-doctrine-fixture

最新稳定版本:0.1.1

Composer 安装命令:

composer require codeedu/zendexpr-doctrine-fixture

包简介

Zend Expressive Library that provides Doctrine Data-Fixture functionality

README 文档

README

Build Status

About

This library provides integration with Zend Expressive and Doctrine Data Fixture. Also support PSR-11.

Get started

Instalation
composer require codeedu/zendexpr-doctrine-fixture:0.1.1
Registering Fixtures

To register fixtures add the fixtures in your configuration.

[
      'doctrine' => [
            'fixture' => [
                  'MyFixtures' => __DIR__ . '/../src/Fixture',
            ]
      ]
];

Register factory to create the command:

[
      'factories' => [
         'doctrine:fixtures_cmd:load'   => \CodeEdu\FixtureFactory::class
      ]
];

We suggest to configure Doctrine ORM and commands with Zend Expressive using this gist. This configuration uses DoctrineModule. DoctrineModule provides easily configuration to integration Doctrine ORM in Zend Framework 2 Applications, so the approach is enjoy it.

Now in doctrine.config.php, so add doctrine:fixtures_cmd:load to:

$command = [
   //.....,
   'doctrine:fixtures_cmd:load'
];

Usage

Command Line

Access the Doctrine command line as following

Import

./vendor/bin/doctrine-module data-fixture:import

Dependency Injection with Fixtures

This library provides inject the service container in fixtures. So add interface FixtureContainerInterface, see below:

class MyFixture implements FixtureInterface, FixtureContainerInterface
{
    private $container;

    public function load(ObjectManager $manager){
        $myService = $this->container->get(MyService::class);
    }

    public function getContainer()
    {
        return $this->container;
    }

    public function setContainer(ContainerInterface $container)
    {
        $this->container = $container;
    }
}

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-06-09

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固