2017 © Pedro PelĂĄez
 

library doctrine-yaml-annotations

Custom annotations for YAML mapping

image

fmasa/doctrine-yaml-annotations

Custom annotations for YAML mapping

  • Saturday, February 3, 2018
  • by fmasa
  • Repository
  • 1 Watchers
  • 0 Stars
  • 1,202 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 25 % Grown

The README.md

Doctrine YAML annotations

Build Status Coverage Status, (*1)

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., (*2)

This package adds custom annotations to your YAML mapping files., (*3)

What is currently supported: - property annotations (fields and embeddables) - class annotations, (*4)

Installation

The best way to install fmasa/doctrine-yaml-annotations is using Composer:, (*5)

$ composer require fmasa/doctrine-yaml-annotations

For example let's configure the Consistence extension for Doctrine., (*6)

First we have to create annotation reader:, (*7)

use Fmasa\DoctrineYamlAnnotations\YamlReader;

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

Second argument for AnnotationReader is optional map with entity aliases., (*8)

Add annotations to your mapping files:, (*9)

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:, (*10)

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

The Versions

03/02 2018

dev-master

9999999-dev

Custom annotations for YAML mapping

  Sources   Download

MIT

The Requires

 

The Development Requires

03/02 2018

1.1.0

1.1.0.0

Custom annotations for YAML mapping

  Sources   Download

MIT

The Requires

 

The Development Requires

21/11 2017

1.0.1

1.0.1.0

Custom annotations for YAML mapping

  Sources   Download

MIT

The Requires

 

The Development Requires

02/04 2017

1.0.0

1.0.0.0

Custom annotations for YAML mapping

  Sources   Download

MIT

The Requires

 

The Development Requires