如果你在没有 Symfony 的情况下使用 Doctrine2,那么你应该将这一行添加到你的引导程序中:
// With this expression all tables prefixed with Table1 will ignored by the schema tool.
$entityManager->getConnection()->getConfiguration()->setFilterSchemaAssetsExpression("~^(?!Table1)~");
整个引导程序看起来像
<?php
// bootstrap.php
use Doctrine\ORM\Tools\Setup;
use Doctrine\ORM\EntityManager;
// Include Composer Autoload (relative to project root).
require_once "vendor/autoload.php";
// Create a simple "default" Doctrine ORM configuration for Annotations
$isDevMode = true;
$paths = array(__DIR__."/doctrine/entities");
$config = Setup::createAnnotationMetadataConfiguration($paths, $isDevMode);
//$config = Setup::createYAMLMetadataConfiguration(array(__DIR__."/doctrine/yaml"), $isDevMode);
// the connection configuration
$dbParams = array(
'driver' => 'pdo_mysql',
'user' => 'username',
'password' => 'password',
'dbname' => 'database',
);
/** @var $entityManager \Doctrine\ORM\EntityManager */
$entityManager = EntityManager::create($dbParams, $config);
// Set the other connections parameters
$conn = $entityManager->getConnection();
$platform = $conn->getDatabasePlatform();
$platform->registerDoctrineTypeMapping('enum', 'string');
// With this expression all tables prefixed with t_ will ignored by the schema tool.
$conn->getConfiguration()->setFilterSchemaAssetsExpression("~^(?!t__)~");