I'm using the master branch of Doctrine MongoDB ODM and Symfony2 from the git repositories along with mongo extension 1.2.10.
I've created a number of classes/documents with annotations similar to:
namespace Acme\StoreBundle\Document;
use Doctrine\ODM\MongoDB\Mapping\Annotations as MongoDB;
/**
* @MongoDB\Document
*/
class Person
{
/**
* @MongoDB\Id
*/
protected $id;
/**
* @MongoDB\String(nullable=false)
*/
protected $name;
/**
* @MongoDB\ReferenceOne(targetDocument="PersonType", inversedBy="person", nullable=false)
*/
protected $personType;
}
When I create and persist a new document without setting the value or reference I receive no error. Am I misunderstanding the use of the nullable option and need to call validation code in the lifecycle callbacks, using the annotation incorrectly, or maybe a bug in Doctrine?