msgphp/eav-bundle

Basic entity-attribute-value management (the `EAV` domain)

v0.4.4 2018-05-06 16:38 UTC

README

A Symfony bundle for basic EAV management.

Latest Stable Version

This package is part of the Message driven PHP project.

MsgPHP is a project that aims to provide (common) message based domain layers for your application. It has a low development time overhead and avoids being overly opinionated.

Installation

composer require msgphp/eav-bundle

Features

  • Symfony 3.4 / 4.0 ready
  • Doctrine persistence
  • Standard supported attribute value types: bool, int, float, string, \DateTimeInterface and null

Configuration

<?php
// config/packages/msgphp_eav.php

use MsgPhp\Eav\Entity\{Attribute, AttributeValue};
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

return function (ContainerConfigurator $container) {
    $container->extension('msgphp_eav', [
        'class_mapping' => [
            Attribute::class => \App\Entity\Eav\Attribute::class,
            AttributeValue::class => \App\Entity\Eav\AttributeValue::class,
        ],
    ]);
};

And be done.

Usage

With DoctrineBundle

Repositories from MsgPhp\Eav\Infra\Doctrine\Repository\* are registered as a service. Corresponding domain interfaces from MsgPhp\Eav\Repository\* are aliased.

Minimal configuration:

# config/packages/doctrine.yaml

doctrine:
    orm:
        mappings:
            app:
                dir: '%kernel.project_dir%/src/Entity'
                type: annotation
                prefix: App\Entity
  • Requires doctrine/orm

Documentation

Contributing

This repository is READ ONLY. Issues and pull requests should be submitted in the main development repository.