Doctrine\ODM\MongoDB\Mapping\ClassMetadataInfo::__construct PHP Method

__construct() public method

Initializes a new ClassMetadata instance that will hold the object-document mapping metadata of the class with the given name.
public __construct ( string $documentName )
$documentName string The name of the document class the new instance is used for.
    public function __construct($documentName)
    {
        $this->name = $documentName;
        $this->rootDocumentName = $documentName;
    }

Usage Example

Example #1
0
 /**
  * Initializes a new ClassMetadata instance that will hold the object-document mapping
  * metadata of the class with the given name.
  *
  * @param string $documentName The name of the document class the new instance is used for.
  */
 public function __construct($documentName)
 {
     parent::__construct($documentName);
     $this->reflClass = new \ReflectionClass($documentName);
     $this->namespace = $this->reflClass->getNamespaceName();
     $this->setCollection($this->reflClass->getShortName());
 }
ClassMetadataInfo