定制 fightmaster/dao 二次开发

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

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

fightmaster/dao

Composer 安装命令:

composer require fightmaster/dao

包简介

Simple implementation of Data Access Object pattern for Symfony 2 projects.

README 文档

README

Simple implementation of Data Access Object pattern for symfony 2 projects.

  • Has unit tests: yes
  • Vendors: doctrine-common

Advantages

  • allows you to quickly switch between the ORM and ODM doctrine managers
  • promote clean and tested code. all of the business application logic should be in the services

Build Status

Installation

If you use a deps file, you could add:

 [dao]
     git=https://github.com/fightmaster/dao.git
 

Or if you want to clone the repos:

 git clone https://github.com/fightmaster/dao.git vendor/dao
 

If you use Composer, you could add:

{"require": {"fightmaster/dao": "1.x"}}

Add the namespace to your autoloader

<?php
 $loader->registerNamespaces(array(
     ............
     'Fightmaster'   => __DIR__.'/../vendor/dao/src',
     ...........
 ));

Examples

Example service layer

<?php
.....
Class ProductService extends Service
{
    public function __construct(ManagerInterface $manager)
    {
        $this->manager = $manager;
    }
    ....
    public function saveProduct(Product $product)
    {
        $prePersistEvent = new PrePersistEvent($product);
        $this->dispatcher->dispatch('product_pre_persist', $prePersistEvent);
        if (!$prePersistEvent->isAborted()) {
            $this->manager->save($product);
        }
        $postPersistEvent = new PostPersistEvent($product);
        $this->dispatcher->dispatch('product_post_persist', $postPersistEvent);
    }

    public function changeProductName(Product $product, $newName)
    {
        ....
        $product->setName($newName);
        $this->saveProduct($product);
    }
}

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2012-07-08

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固