本文整理匯總了PHP中Doctrine\ORM\EntityManager::getMetaDataFactory方法的典型用法代碼示例。如果您正苦於以下問題:PHP EntityManager::getMetaDataFactory方法的具體用法?PHP EntityManager::getMetaDataFactory怎麽用?PHP EntityManager::getMetaDataFactory使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Doctrine\ORM\EntityManager
的用法示例。
在下文中一共展示了EntityManager::getMetaDataFactory方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: setUp
protected function setUp()
{
$this->em = $this->getEntityManager();
$schemaTool = new SchemaTool($this->em);
$classes = $this->em->getMetaDataFactory()->getAllMetadata();
$schemaTool->dropSchema($classes);
$schemaTool->createSchema($classes);
}
示例2: setupTestSchema
private function setupTestSchema()
{
$this->entityManager->clear();
$classes = $this->entityManager->getMetaDataFactory()->getAllMetaData();
$tool = new Doctrine\ORM\Tools\SchemaTool($this->entityManager);
// $tool->dropSchema($classes);
$tool->createSchema($classes);
}
示例3: setupTestSchema
private function setupTestSchema()
{
if ($this->metaDataClassNames === null) {
$classes = $this->entityManager->getMetaDataFactory()->getAllMetaData();
} else {
$classes = [];
foreach ($this->metaDataClassNames as $className) {
$classes[] = $this->entityManager->getMetaDataFactory()->getMetadataFor($className);
}
}
$tool = new SchemaTool($this->entityManager);
$tool->createSchema($classes);
}
示例4: setupTestSchema
private function setupTestSchema()
{
$this->entityManager->clear();
if (empty($this->metaDataClassNames)) {
$classes = $this->entityManager->getMetaDataFactory()->getAllMetaData();
} else {
$classes = [];
foreach ($this->metaDataClassNames as $className) {
$classes[] = $this->entityManager->getMetaDataFactory()->getMetadataFor($className);
}
}
$tool = new Doctrine\ORM\Tools\SchemaTool($this->entityManager);
// $tool->dropSchema($classes);
$tool->createSchema($classes);
}
示例5: create
/**
* Get database connection.
*
* @static
*
* @return DatabaseConnection
*/
public static function create($mappingPath)
{
self::$_config = array('dbname' => $GLOBALS['db_name'], 'driver' => 'pdo_mysql', 'host' => $GLOBALS['db_host'], 'user' => $GLOBALS['db_user'], 'password' => $GLOBALS['db_password'], 'charset' => 'UTF8');
self::createDatabase(self::$_config);
/** @var \Doctrine\ORM\Configuration */
$metadataConfiguration = Setup::createAnnotationMetadataConfiguration(array($mappingPath), true, null, null, false);
self::$_em = EntityManager::create(self::$_config, $metadataConfiguration);
$pdo = self::$_em->getConnection()->getWrappedConnection();
self::$_em->clear();
$tool = new SchemaTool(self::$_em);
$classes = self::$_em->getMetaDataFactory()->getAllMetaData();
$tool->dropSchema($classes);
$tool->createSchema($classes);
return new self();
}
示例6: getConnection
public function getConnection()
{
$this->em = EntityManagerFactory::createEntityManager(__DIR__ . '/../../../../app/config/parameters_test.yml', __DIR__ . '/../../../../src', false);
// Retrieve PDO instance
$pdo = $this->em->getConnection()->getWrappedConnection();
// Clear Doctrine to be safe
$this->em->clear();
// Schema Tool to process our entities
$tool = new SchemaTool($this->em);
$classes = $this->em->getMetaDataFactory()->getAllMetaData();
// Drop all classes and re-build them for each test case
$tool->dropSchema($classes);
$tool->createSchema($classes);
// Pass to PHPUnit
return $this->createDefaultDBConnection($pdo, 'angular_cms_test');
}
示例7: __construct
/**
*
*/
public function __construct(EntityManager $entity_manager)
{
$metadata_factory = $entity_manager->getMetaDataFactory();
foreach ($metadata_factory->getAllMetaData() as $class => $metadata) {
if ($metadata->customRepositoryClassName == get_class($this)) {
$this->model = $metadata->getName();
}
}
parent::__construct($entity_manager, $entity_manager->getclassMetaData($this->model));
}
示例8: createDatabase
public static function createDatabase(EntityManager $em)
{
// Clear Doctrine to be safe
$em->clear();
// Schema Tool to process our entities
$tool = new SchemaTool($em);
$classes = $em->getMetaDataFactory()->getAllMetaData();
// Drop all classes and re-build them for each test case
$tool->dropSchema($classes);
$tool->createSchema($classes);
}
示例9: setUp
protected function setUp()
{
if (!class_exists('\\Doctrine\\ORM\\Configuration')) {
static::markTestSkipped('Doctrine is not available');
}
$config = new Configuration();
$config->setMetadataCacheImpl(new ArrayCache());
$config->setQueryCacheImpl(new ArrayCache());
$config->setProxyDir(__DIR__ . '/Proxies');
$config->setProxyNamespace('Boldtrn\\JsonbBundle\\Tests\\Proxies');
$config->setAutoGenerateProxyClasses(true);
$config->setMetadataDriverImpl($config->newDefaultAnnotationDriver(__DIR__ . '/Entities'));
$config->addEntityNamespace('E', 'Boldtrn\\JsonbBundle\\Tests\\Entities');
$config->setCustomStringFunctions(array('JSONB_AG' => 'Boldtrn\\JsonbBundle\\Query\\JsonbAtGreater', 'JSONB_HGG' => 'Boldtrn\\JsonbBundle\\Query\\JsonbHashGreaterGreater', 'JSONB_EX' => 'Boldtrn\\JsonbBundle\\Query\\JsonbExistence'));
$this->entityManager = EntityManager::create($this->dbParams, $config);
$this->connection = $this->entityManager->getConnection();
$this->setUpDBALTypes();
$tool = new SchemaTool($this->entityManager);
$classes = $this->entityManager->getMetaDataFactory()->getAllMetaData();
// Drop all classes and re-build them for each test case
$tool->dropSchema($classes);
$tool->createSchema($classes);
}
示例10: getEntityManager
/**
* @return EntityManager|object
* @throws \Doctrine\ORM\Tools\ToolsException
*/
public function getEntityManager()
{
if (!self::$entityManager instanceof EntityManager) {
$kernel = static::createKernel();
$kernel->boot();
self::$entityManager = $kernel->getContainer()->get('doctrine.orm.entity_manager');
// Clear Doctrine to be safe
self::$entityManager->clear();
// Schema Tool to process our entities
$tool = new SchemaTool(self::$entityManager);
$classes = self::$entityManager->getMetaDataFactory()->getAllMetaData();
// Drop all classes and re-build them for each test case
$tool->dropSchema($classes);
$tool->createSchema($classes);
//create our api user on first run
$this->getUser();
}
return self::$entityManager;
}
示例11: dropSchema
public function dropSchema()
{
$classes = $this->entityManager->getMetaDataFactory()->getAllMetaData();
$this->schemaTool->dropSchema($classes);
}