/**
  * {% inheritdoc %}
  */
 public function validate(DocumentInterface $document)
 {
     foreach ($document->getProperties() as $property => $typeOptions) {
         $isValid = $this->validateOneProperty($document, $property, $typeOptions);
     }
     return (bool) (!(count($this->getErrors()) > 0));
 }
 /**
  * updateCurrent
  * 
  * @param  Symflo\MongoDBODM\Document\DocumentInterface $currentdocument
  */
 public function updateCurrent(DocumentInterface $currentdocument)
 {
     foreach ($this as $document) {
         $currentdocument->setIsCurrent($currentdocument === $document);
     }
 }
 /**
  * getId
  * @param  DocumentInterface|array $document
  * @return \MongoId
  */
 public static function getId($document)
 {
     if ($document instanceof DocumentInterface) {
         $mongoId = $document->get_id();
     } elseif (is_array($document) && array_key_exists('_id', $document)) {
         $mongoId = $document['_id'];
     } else {
         throw new \Exception("Document must implement Symflo\\MongoDBODM\\Document\\DocumentInterface or key _id");
     }
     return $mongoId;
 }
 /**
  * isNew
  * @param  DocumentInterface $document
  * @return boolean 
  */
 private function isNew(DocumentInterface $document)
 {
     return (bool) (null === $document->get_id());
 }