I´m new in Symfony 3.4 and I am try to embed a document into another document, like this:
{
name:"alex",
age: 18,
schoolGrades:{
elementary: "yes",
highScholl: "yes",
college: "no"
}
}
I´m using Doctrine ODM to work this, but I don´t know how I can do this.
There's a concept of Embedded documents that does exactly that:
/** @Document */
class Student
{
/** @EmbedOne(targetDocument="SchoolGrades") */
private $schoolGrades;
}
/** @EmbeddedDocument */
class SchoolGrades
{
}