Doctrine\ORM\EntityManager::getClassMetadata PHP Method

getClassMetadata() public method

The class name must be the fully-qualified class name without a leading backslash (as it is returned by get_class($obj)) or an aliased class name. Examples: MyProject\Domain\User sales:PriceRequest
public getClassMetadata ( $className ) : Doctrine\ORM\Mapping\ClassMetadata
return Doctrine\ORM\Mapping\ClassMetadata
    public function getClassMetadata($className)
    {
        return $this->metadataFactory->getMetadataFor($className);
    }

Usage Example

 protected function setUp()
 {
     if (!class_exists('Symfony\\Component\\Form\\Form')) {
         $this->markTestSkipped('The "Form" component is not available');
     }
     if (!class_exists('Doctrine\\DBAL\\Platforms\\MySqlPlatform')) {
         $this->markTestSkipped('Doctrine DBAL is not available.');
     }
     if (!class_exists('Doctrine\\Common\\Version')) {
         $this->markTestSkipped('Doctrine Common is not available.');
     }
     if (!class_exists('Doctrine\\ORM\\EntityManager')) {
         $this->markTestSkipped('Doctrine ORM is not available.');
     }
     $this->em = DoctrineTestHelper::createTestEntityManager();
     $schemaTool = new SchemaTool($this->em);
     $classes = array($this->em->getClassMetadata(self::SINGLE_INT_ID_CLASS), $this->em->getClassMetadata(self::SINGLE_STRING_ID_CLASS), $this->em->getClassMetadata(self::COMPOSITE_ID_CLASS), $this->em->getClassMetadata(self::GROUPABLE_CLASS));
     try {
         $schemaTool->dropSchema($classes);
     } catch (\Exception $e) {
     }
     try {
         $schemaTool->createSchema($classes);
     } catch (\Exception $e) {
     }
     parent::setUp();
 }
All Usage Examples Of Doctrine\ORM\EntityManager::getClassMetadata