martin187/doctrine-set-type 问题修复 & 功能扩展

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

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

martin187/doctrine-set-type

最新稳定版本:1.1

Composer 安装命令:

composer require martin187/doctrine-set-type

包简介

Set Type for Doctrine

README 文档

README

Doctrine Logo

Set Type for Doctrine

Install

The recommended way to install is through Composer:

composer require martin187/doctrine-set-type

The simplest example of use

<?php

namespace Acme\Types;


use Doctrine\DBAL\Types\SetType;

class RolesType extends SetType {

    const NAME = 'roles_type';

    const ROLE_SUPER_USER_VALUE = 'ROLE_SUPER_USER';
    const ROLE_ADMIN_VALUE = 'ROLE_ADMIN';
    const ROLE_USER_VALUE = 'ROLE_USER';
    const ROLE_NONE_VALUE = 'ROLE_NONE';


    protected function getValue() {
        return array(
            self::ROLE_SUPER_USER_VALUE,
            self::ROLE_ADMIN_VALUE,
            self::ROLE_USER_VALUE,
            self::ROLE_NONE_VALUE
        );
    }


    public function getName() {
        return self::NAME;
    }
}
Example use entities
<?php

namespace Acme\Entities;


use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Entity()
 *
 * @ORM\Table(
 *     name = "users"
 * )
 */
class User {

    /**
     * @ORM\Column(
     *     type = "roles_type"
     * )
     */
    private $roles;
}

Warning

Do not forget to register the type!

\Doctrine\DBAL\Types\TypeType::addType(RolesType::NAME, RolesType::class);

/** @var \Doctrine\DBAL\Connection $conn */
$conn->getDatabasePlatform()->registerDoctrineTypeMapping('roles', RolesType::NAME);

License

This bundle is under the MIT license. See the complete license in the file: here.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-11-11

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固