承接 cimrie/slick 相关项目开发

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

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

cimrie/slick

Composer 安装命令:

composer require cimrie/slick

包简介

Fluent ODM Metadata Builder for cimrie/odm, the FW Integration package for Doctrine MongoDB ODM.

README 文档

README

Doctrine ODM Fluent Metadata Class Implementation. Inspired by laravel-doctrine/fluent. Integrates seamlessly with cimrie/odm.

Laravel Setup

Add CImrie\Slick\SlickServiceProvider::class to the 'providers' section of config/app.php. Follow the instructions for cimrie/odm.

In config/odm.php set 'meta' to CImrie\Slick\Mapping\SlickDriver::class For each manager in config/odm.php specify a 'mappings' array like so:

<?php

return [
    'managers' => [
       
        'default' => [
            // ...
            
            'meta'      => env('DOCTRINE_METADATA', \CImrie\Slick\Mapping\SlickDriver::class),
            'mappings'  => [
               MyCustomMappingClass::class 
            ]
            
            // ...
        ]
    ]
];

Usage

To set up your mapping files, you should extend one of the following classes:

  • Normal Documents: CImrie\Slick\Mapping\DocumentMapping::class,
  • Embedded Documents: CImrie\Slick\Mapping\EmbeddedMapping::class,
  • Mapped Superclass Documents: CImrie\Slick\Mapping\MappedSuperclassMapping::class

In each of the mapping files you will need to specify a mapFor and a map(Slick $builder) method implementaton. mapFor should simply return the class name of the document you wish to map.

map(...) should make use of the $builder variable given in order to specify its mapping. For example:

<?php

use \Tests\Model\Documents\User;
use CImrie\Slick\Slick;

class CustomMapping extends \CImrie\Slick\Mapping\DocumentMapping
{
    public static function mapFor(){
        return User::class;
    }
    
    public function map(Slick $builder)
    {
        $builder->id();
        $builder->string('name');
        $builder->string('email')->unique();
        // alternatively add the unique constraint manually
        //... $builder->index()->key('email')->unique();
        
        $builder->date('joinedAt');
    }
}

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-01-29

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固