本文整理匯總了PHP中Doctrine\DBAL\Schema\AbstractSchemaManager::tablesExist方法的典型用法代碼示例。如果您正苦於以下問題:PHP AbstractSchemaManager::tablesExist方法的具體用法?PHP AbstractSchemaManager::tablesExist怎麽用?PHP AbstractSchemaManager::tablesExist使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Doctrine\DBAL\Schema\AbstractSchemaManager
的用法示例。
在下文中一共展示了AbstractSchemaManager::tablesExist方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: setName
/**
* @param $name
*
* @throws SchemaException
*/
public function setName($name)
{
if (!$this->sm->tablesExist($this->prefix . $name)) {
throw new SchemaException("Table {$name} does not exist!");
}
$this->table = $this->sm->listTableDetails($this->prefix . $name);
}
示例2: createModel
/**
* @param Config $config
* @return EloquentModel
* @throws GeneratorException
*/
public function createModel(Config $config)
{
$model = new EloquentModel($config->get('class_name'), $config->get('base_class_name'), $config->get('table_name'));
if (!$this->manager->tablesExist($this->tablePrefix . $model->getTableName())) {
throw new GeneratorException(sprintf('Table %s does not exist', $this->tablePrefix . $model->getTableName()));
}
$this->setNamespace($model, $config)->setCustomProperties($model, $config)->setFields($model)->setRelations($model);
return $model;
}
示例3: onSuccess
public function onSuccess(Form $form)
{
if (!Callback::create($this->checkConnection)->invoke() || !$this->schemaManager->tablesExist('users')) {
return;
}
$presenter = $form->presenter;
$logEntity = new LogEntity($this->user instanceof UserEntity ? $this->user : NULL, 'Venne\\Forms\\Form', NULL, LogEntity::ACTION_OTHER);
$logEntity->setType($presenter->link('this'));
$logEntity->setMessage('Configuration has been updated');
$this->logRepository->save($logEntity);
}
示例4: __construct
/**
* constructor
* @param string $table_name
* @param Connection $conn
*/
public function __construct($table_name, \Doctrine\DBAL\Connection $conn)
{
$this->conn = $conn;
$this->table_name = $table_name;
$this->quoted_table_name = $this->conn->quoteIdentifier($this->table_name);
$this->sm = $this->conn->getSchemaManager();
if (!$this->sm->tablesExist([$table_name])) {
throw Schema\SchemaException::tableDoesNotExist($table_name);
}
foreach ($this->sm->listTableColumns($this->table_name) as $colum) {
$this->columns[$colum->getName()] = $colum;
$this->column_types[$colum->getName()] = $colum->getType()->getName();
}
}
示例5: tableExist
private function tableExist()
{
try {
$name = $this->em->getClassMetadata('RenderBundle:Queue')->getTableName();
return $this->sm->tablesExist($name);
} catch (\Exception $e) {
return false;
}
}
示例6: checkTableExists
/**
* Determine if a table exists.
*
* @param string $table
* @param bool $throwException
*
* @return bool
*
* @throws SchemaException
*/
public function checkTableExists($table, $throwException = false)
{
if ($this->sm->tablesExist($this->prefix . $table)) {
if ($throwException) {
throw new SchemaException($this->prefix . "{$table} already exists");
}
return true;
}
return false;
}
示例7: checkTableExists
/**
* Determine if a table exists
*
* @param $table
* @param bool $throwException
* @return bool
*/
public function checkTableExists($table, $throwException = false)
{
if (!$this->sm->tablesExist($table)) {
if ($throwException) {
throw new SchemaUpdateException("{$table} does not exist");
} else {
return false;
}
} else {
return true;
}
}
示例8: createTable
/**
* @param AbstractSchemaManager $schemaM
* @param Schema $schema
*
* @since 1.1.0
*
* @author Eddilbert Macharia (http://eddmash.com) <edd.cowan@gmail.com>
*/
public function createTable($schemaM, $schema)
{
if ($schemaM->tablesExist('artists')) {
$schemaM->dropTable('artists');
}
if ($schemaM->tablesExist('user')) {
$schemaM->dropTable('user');
}
echo 'Tables :: ';
$UTable = $schema->createTable('user');
$UTable->addColumn('id', 'integer', ['unsigned' => true, 'autoincrement' => true]);
$UTable->addColumn('name', 'string', ['length' => 60]);
$UTable->setPrimaryKey(['id']);
$myTable = $schema->createTable('artists');
$myTable->addColumn('id', 'integer', ['unsigned' => true, 'autoincrement' => true]);
$myTable->addColumn('user_id', 'integer', ['unsigned' => true]);
$myTable->addColumn('name', 'string', ['length' => 60]);
$myTable->setPrimaryKey(['id']);
$myTable->addForeignKeyConstraint($UTable, array('user_id'), array('id'), array('onUpdate' => 'CASCADE'));
$schemaM->createTable($UTable);
$schemaM->createTable($myTable);
}
示例9: tablesExist
/**
* Returns true if all the given tables exist.
*
* @param array $tables
* @return bool
*/
public function tablesExist($tables)
{
$tables = array_map([$this, 'replacePrefix'], (array) $tables);
return $this->manager->tablesExist($tables);
}
示例10: tableExists
private function tableExists()
{
return $this->schemaManager->tablesExist(self::TABLE);
}