本文整理汇总了PHP中Propel\Generator\Model\Index::addVendorInfo方法的典型用法代码示例。如果您正苦于以下问题:PHP Index::addVendorInfo方法的具体用法?PHP Index::addVendorInfo怎么用?PHP Index::addVendorInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Propel\Generator\Model\Index
的用法示例。
在下文中一共展示了Index::addVendorInfo方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ForeignKey
$fkPostTag = new ForeignKey('fk_post_has_tags');
$fkPostTag->addReference('post_id', 'id');
$fkPostTag->setForeignTableCommonName('blog_post');
$fkPostTag->setPhpName('Post');
$fkPostTag->setDefaultJoin('Criteria::LEFT_JOIN');
$fkPostTag->setOnDelete('CASCADE');
$fkTagPost = new ForeignKey('fk_tag_has_posts');
$fkTagPost->addReference('tag_id', 'id');
$fkTagPost->setForeignTableCommonName('blog_tag');
$fkTagPost->setPhpName('Tag');
$fkTagPost->setDefaultJoin('Criteria::LEFT_JOIN');
$fkTagPost->setOnDelete('CASCADE');
/* Regular Indexes */
$pageContentFulltextIdx = new Index('page_content_fulltext_idx');
$pageContentFulltextIdx->setColumns([['name' => 'content']]);
$pageContentFulltextIdx->addVendorInfo(new VendorInfo('mysql', ['Index_type' => 'FULLTEXT']));
/* Unique Indexes */
$authorUsernameUnique = new Unique('author_password_unique_idx');
$authorUsernameUnique->setColumns([['name' => 'username', 'size' => '8']]);
/* Behaviors */
$timestampableBehavior = new TimestampableBehavior();
$timestampableBehavior->setName('timestampable');
$sluggableBehavior = new SluggableBehavior();
$sluggableBehavior->setName('sluggable');
/* Tables */
$table1 = new Table('blog_post');
$table1->setDescription('The list of posts');
$table1->setNamespace('Blog');
$table1->setPackage('Acme.Blog');
$table1->addColumns([$column11, $column12, $column13, $column14, $column15, $column16, $column17]);
$table1->addForeignKeys([$fkAuthorPost, $fkCategoryPost]);
示例2: testGetIndexDDLFulltext
public function testGetIndexDDLFulltext()
{
$table = new Table('foo');
$table->setIdentifierQuoting(true);
$column1 = new Column('bar1');
$column1->getDomain()->copy($this->getPlatform()->getDomainForType('LONGVARCHAR'));
$table->addColumn($column1);
$index = new Index('bar_index');
$index->addColumn($column1);
$vendor = new VendorInfo('mysql');
$vendor->setParameter('Index_type', 'FULLTEXT');
$index->addVendorInfo($vendor);
$table->addIndex($index);
$expected = 'FULLTEXT INDEX `bar_index` (`bar1`)';
$this->assertEquals($expected, $this->getPlatform()->getIndexDDL($index));
}
示例3: startElement
public function startElement($parser, $name, $attributes)
{
$parentTag = $this->peekCurrentSchemaTag();
if (false === $parentTag) {
switch ($name) {
case 'database':
if ($this->isExternalSchema()) {
$this->currentPackage = isset($attributes['package']) ? $attributes['package'] : null;
if (null === $this->currentPackage) {
$this->currentPackage = $this->defaultPackage;
}
} else {
$this->currDB = $this->schema->addDatabase($attributes);
}
break;
default:
$this->_throwInvalidTagException($parser, $name);
}
} elseif ('database' === $parentTag) {
switch ($name) {
case 'external-schema':
$xmlFile = isset($attributes['filename']) ? $attributes['filename'] : null;
// 'referenceOnly' attribute is valid in the main schema XML file only,
// and it's ignored in the nested external-schemas
if (!$this->isExternalSchema()) {
$isForRefOnly = isset($attributes['referenceOnly']) ? $attributes['referenceOnly'] : null;
$this->isForReferenceOnly = null !== $isForRefOnly ? 'true' === strtolower($isForRefOnly) : true;
// defaults to TRUE
}
if ('/' !== $xmlFile[0]) {
$xmlFile = realpath(dirname($this->currentXmlFile) . DIRECTORY_SEPARATOR . $xmlFile);
if (!file_exists($xmlFile)) {
throw new SchemaException(sprintf('Unknown include external "%s"', $xmlFile));
}
}
$this->parseFile($xmlFile);
break;
case 'domain':
$this->currDB->addDomain($attributes);
break;
case 'table':
if (!isset($attributes['schema']) && $this->currDB->getSchema() && $this->currDB->getPlatform()->supportsSchemas() && false === strpos($attributes['name'], $this->currDB->getPlatform()->getSchemaDelimiter())) {
$attributes['schema'] = $this->currDB->getSchema();
}
$this->currTable = $this->currDB->addTable($attributes);
if ($this->isExternalSchema()) {
$this->currTable->setForReferenceOnly($this->isForReferenceOnly);
$this->currTable->setPackage($this->currentPackage);
}
break;
case 'vendor':
$this->currVendorObject = $this->currDB->addVendorInfo($attributes);
break;
case 'behavior':
$this->currBehavior = $this->currDB->addBehavior($attributes);
break;
default:
$this->_throwInvalidTagException($parser, $name);
}
} elseif ('table' === $parentTag) {
switch ($name) {
case 'column':
$this->currColumn = $this->currTable->addColumn($attributes);
break;
case 'foreign-key':
$this->currFK = $this->currTable->addForeignKey($attributes);
break;
case 'index':
$this->currIndex = new Index();
$this->currIndex->setTable($this->currTable);
$this->currIndex->loadMapping($attributes);
break;
case 'unique':
$this->currUnique = new Unique();
$this->currUnique->setTable($this->currTable);
$this->currUnique->loadMapping($attributes);
break;
case 'vendor':
$this->currVendorObject = $this->currTable->addVendorInfo($attributes);
break;
case 'id-method-parameter':
$this->currTable->addIdMethodParameter($attributes);
break;
case 'behavior':
$this->currBehavior = $this->currTable->addBehavior($attributes);
break;
default:
$this->_throwInvalidTagException($parser, $name);
}
} elseif ('column' === $parentTag) {
switch ($name) {
case 'inheritance':
$this->currColumn->addInheritance($attributes);
break;
case 'vendor':
$this->currVendorObject = $this->currColumn->addVendorInfo($attributes);
break;
default:
$this->_throwInvalidTagException($parser, $name);
}
//.........这里部分代码省略.........