public function setIdentifier($identifier) { if ($this->isEmbeddedDocument) { throw new MappingException('EmbeddedDocument should not have id field'); } $this->identifier = $identifier; }