予約のためにいくつかのデータを保存する必要があります。これには予約データ内に埋め込みドキュメントとして必要な顧客データが含まれています。現在の設定では、すべてのデータがMongoDBに保存されますが、予約文書をロードするときに、関連する顧客オブジェクトはありません。私は設定や他の何かを忘れましたか?Doctrine ODM MongoDB EmbedOneドキュメントがロードされていません
予約 - ドキュメント:
これは私の文書がどのように見えるかです
<?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...
}
カスタマー・ドキュメント
<?php
namespace AppBundle\Document;
use Doctrine\ODM\MongoDB\Mapping\Annotations as MongoDB;
/**
* @MongoDB\EmbeddedDocument
*/
class Customer
{
// fields, getter and setter
}
代わりに '@MongoDB \ EmbedOne(targetDocument =" Customer ")'を試してください。 – BentCoder
'CTRL + F'を実行し、symfony + mongodbの例については' mongo' [here](http://www.inanzzz.com/index.php/posts/symfony)を探してください。例えば[symfonyのEmbedOneの簡単な教訓mongodbの例](http://www.inanzzz.com/index.php/post/aefp/simple-doctrine-mongodb-example-for-embed-one-in-symfony) – BentCoder