I need to store some data for our booking and thats include the customer data, which I want as embedded document within my booking document. With my current configuration all data are persisted in MongoDB, but when I load the booking document, there is no related customer object. Did I forget some configuration or something else?
This is how my documents look like:
The Booking-Document:
<?php
namespace AppBundle\Document;
use Doctrine\ODM\MongoDB\Mapping\Annotations as MongoDB;
/**
* @MongoDB\Document
*/
class Booking
{
/**
* @MongoDB\EmbedOne(targetDocument="\AppBundle\Document\Customer")
*/
private $customer;
// getter and setter...
}
The Customer-Document
<?php
namespace AppBundle\Document;
use Doctrine\ODM\MongoDB\Mapping\Annotations as MongoDB;
/**
* @MongoDB\EmbeddedDocument
*/
class Customer
{
// fields, getter and setter
}
@MongoDB\EmbedOne(targetDocument="Customer")
instead. – BentCoderCTRL+F
and look formongo
here for symfony+mongodb examples. e.g. Simple doctrine mongodb example for EmbedOne in symfony – BentCoder