In the Symfony documentation about Embed forms, I just read this :
class Task{
/**
* @Assert\Type(type="AppBundle\Entity\Category")
* @Assert\Valid()
*/
protected $category;
// ...
}
They later say that
The Category instance is accessible naturally via $task->getCategory() and can be persisted to the database or used however you need.
How is that different from a Many-To-One mapping ? (many tasks for one category of course)
Well, ORM mapping map the php class to the doctrine metadata.
Assert is a mecanism to validate objects.
It means you could use assert on objects wich are not entities or you could not use a mapped field in your formType
ManyToOne map an object to another from the doctrine point of view. Assert\Type indicate that this attribute of your form is validated like another related object, wich is Category