2017 © Pedro Peláez
 

library doctrine-blender-bundle

Bundle in change of the mapado/doctrine-blender package configuration

image

mapado/doctrine-blender-bundle

Bundle in change of the mapado/doctrine-blender package configuration

  • Monday, October 23, 2017
  • by jdeniau
  • Repository
  • 8 Watchers
  • 1 Stars
  • 4,729 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 6 Versions
  • 5 % Grown

The README.md

Doctrine Blender Bundle

This bundle in charge of the https://github.com/mapado/doctrine-blender integration into a Symfony project., (*1)

Installation

composer require "mapado/doctrine-blender-bundle:0.*"

Usage

Entities

Taken from doctrine mongodb documentation, (*2)

First lets define our Product document:, (*3)

/** @Document */
class Product
{
    /** @Id */
    private $id;

    /** @String */
    private $title;

    public function getId()
    {
        return $this->id;
    }

    public function getTitle()
    {
        return $this->title;
    }

    public function setTitle($title)
    {
        $this->title = $title;
    }
}

Next create the Order entity that has a $product and $productId property linking it to the Product that is stored with MongoDB:, (*4)

namespace Entities;

use Documents\Product;

/**
 * @Entity
 * @Table(name="orders")
 */
class Order
{
    /**
     * @Id @Column(type="integer")
     * @GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @Column(type="string")
     */
    private $productId;

    /**
     * @var Documents\Product
     */
    private $product;

    public function getId()
    {
        return $this->id;
    }

    public function getProductId()
    {
        return $this->productId;
    }

    public function setProduct(Product $product)
    {
        $this->productId = $product->getId();
        $this->product = $product;
    }

    public function getProduct()
    {
        return $this->product;
    }
}

Configuration

mapado_doctrine_blender:
    doctrine_external_associations:
        order:
            source_object_manager: 'doctrine.orm.order_entity_manager'
            classname: 'Acme\DemoBundle\Entity\Order'
            references:
                product: # this is the name of the property in the source entity
                    reference_id_getter: 'getProductId' # optional, method in the source entity fetching the ref.id
                    reference_setter: 'setProduct' # optional, method in the source entity to set the reference
                    reference_object_manager: 'doctrine_mongodb.odm.product_document_manager'
                    reference_class: 'Acme\DemoBundle\Document\Product'

                tags: # can also be an array (or an iterator)
                    reference_id_getter: 'getTagIds' # must return an array (or an iterator) of identifiers
                    reference_setter: 'setTags'
                    reference_object_manager: 'doctrine_mongodb.odm.tag_document_manager'
                    reference_class: 'Acme\DemoBundle\Document\Tag'

                another_reference:
                    # ...

        another_source:
            # ...

The Versions

23/10 2017

dev-master

9999999-dev

Bundle in change of the mapado/doctrine-blender package configuration

  Sources   Download

MIT

The Requires

 

The Development Requires

12/04 2016

v0.4.1

0.4.1.0

Bundle in change of the mapado/doctrine-blender package configuration

  Sources   Download

MIT

The Requires

 

03/09 2014

v0.4.0

0.4.0.0

Bundle in change of the mapado/doctrine-blender package configuration

  Sources   Download

MIT

The Requires

 

02/09 2014

v0.3.0

0.3.0.0

Bundle in change of the mapado/doctrine-blender package configuration

  Sources   Download

MIT

The Requires

 

01/09 2014

v0.2.0

0.2.0.0

Bundle in change of the mapado/doctrine-blender package configuration

  Sources   Download

MIT

The Requires

 

01/09 2014

v0.1.0

0.1.0.0

Bundle in change of the mapado/doctrine-blender package configuration

  Sources   Download

MIT

The Requires