dev-master
9999999-devHacfi Object Bridge Bundle
MIT
The Requires
- php >=5.3.3
- symfony/framework-bundle ~2.2
by Philipp Wahala
orm database doctrine odm phpcr
Hacfi Object Bridge Bundle
This bundle allows associations between different Doctrine ORMs and ODMs., (*1)
This project is at a experimental state and has limited functionality at the moment. It should work for Doctrine ORM to Doctrine PHPCR ODM, and vice versa (not ORM to ORM or PHPCR ODM to PHPCR ODM though)., (*2)
The related objects are lazy-loaded if they havenât been loaded by the object manager., (*3)
type
is availablePlease note that the use-statement for the annotations has to be "use Hacfi\Bundle\ObjectBridgeBundle\Mapping\ObjectBridge;" and doesnât allow aliasing because the Doctrineâs SimpleAnnotationReader doesnât support it. This might change in the future., (*4)
app/AppKernel.php:, (*5)
new Hacfi\Bundle\ObjectBridgeBundle\HacfiObjectBridgeBundle(),
app/autoload.php:, (*6)
AnnotationRegistry::registerFile(__DIR__.'/../vendor/hacfi/object-bridge-bundle/Hacfi/Bundle/ObjectBridgeBundle/Mapping/ObjectBridge/Reference.php');
/src/Hacfi/AppBundle/Entity/Product.php:, (*7)
<?php namespace Hacfi\AppBundle\Entity; use Hacfi\AppBundle\Document\ProductProperties; use Doctrine\ORM\Mapping as ORM; use Hacfi\Bundle\ObjectBridgeBundle\Mapping\ObjectBridge; /** * Product * * @ORM\Table(name="ecommerce_product") * @ORM\Entity() * @ORM\HasLifecycleCallbacks */ class Product implements ProductInterface { /** * @var integer * * @ORM\Column(name="id", type="integer") * @ORM\Id * @ORM\GeneratedValue(strategy="AUTO") */ private $id; ... /** * @ORM\Column(name="properties", type="string", length=255, nullable=false) * * @ObjectBridge\Reference(type="phpcr", name="HacfiAppBundle:ProductProperties", manager="default") */ private $properties; }
/src/Hacfi/AppBundle/Document/ProductProperties.php:, (*8)
<?php namespace Hacfi\AppBundle\Document; use Hacfi\AppBundle\Entity\Product; use Doctrine\ODM\PHPCR\Mapping\Annotations as PHPCRODM; use Hacfi\Bundle\ObjectBridgeBundle\Mapping\ObjectBridge; /** * ProductProperties * * @PHPCRODM\Document(referenceable=true) */ class ProductProperties { /** @PHPCRODM\Id(strategy="parent") */ protected $id; ... /** * @PHPCRODM\String * * @ObjectBridge\Reference(type="orm", name="HacfiAppBundle:Product", manager="default") */ protected $product; }
Hacfi Object Bridge Bundle
MIT
orm database doctrine odm phpcr