定制 fmasa/doctrine-yaml-annotations 二次开发

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

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

fmasa/doctrine-yaml-annotations

最新稳定版本:1.1.0

Composer 安装命令:

composer require fmasa/doctrine-yaml-annotations

包简介

Custom annotations for YAML mapping

README 文档

README

Build Status Coverage Status

One of the great features of Doctrine 2 is extensibility. Doctrine offers multiple ways to specify mapping information, but the most of the extensions only supports Annotations configuration.

This package adds custom annotations to your YAML mapping files.

What is currently supported:

  • property annotations (fields and embeddables)
  • class annotations

Installation

The best way to install fmasa/doctrine-yaml-annotations is using Composer:

$ composer require fmasa/doctrine-yaml-annotations

For example let's configure the Consistence extension for Doctrine.

First we have to create annotation reader:

use Fmasa\DoctrineYamlAnnotations\YamlReader;

$configuration = $entityManager->getConfiguration();
$reader = new YamlReader($configuration, [
    'enum' => EnumAnnotation::class
]);
    

Second argument for AnnotationReader is optional map with entity aliases.

Add annotations to your mapping files:

Some\Entity:
    
    ...
    
    fields:
        state:
            type: enum_string
            annotations:
                Consistence\Doctrine\Enum\EnumAnnotation: # or just enum
                    class: StateEnum

Now you can read annotations just using Doctrine\Common\Annotations\Reader API:

$reader->getPropertyAnnotation(
    (new \ReflectionClass(Some\Entity::class))->getProperty('state'),
    EnumAnnotation::class
); // returns instance of EnumAnnotation { class => "StateEnum" }

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-04-02

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固