本文整理汇总了PHP中Elastica\Type::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Type::delete方法的具体用法?PHP Type::delete怎么用?PHP Type::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Elastica\Type
的用法示例。
在下文中一共展示了Type::delete方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getType
/**
* Get the currentType
*
* @param $type
* @param bool $createNew
*
* @return \Elastica\Type
*/
public function getType($type, $createNew = false)
{
$this->_type = $this->_index->getType($type);
if ($createNew == true && $this->_type->exists() == true) {
$this->_type->delete();
}
return $this->_type;
}
示例2: doFlush
/**
* @test
*/
public function doFlush()
{
$this->type->delete()->shouldBeCalled();
self::assertTrue($this->cache->flushAll());
$refClass = new \ReflectionClass($this->cache);
$typeProp = $refClass->getProperty('type');
$typeProp->setAccessible(true);
$typeVal = $typeProp->getValue($this->cache);
self::assertNull($typeVal);
}
示例3: deleteMapping
/**
* @param string $typeName
* @return \Elastica\Type
* @throws \Exception
*/
protected function deleteMapping($typeName)
{
$type = new Elastica\Type($this->index, $typeName);
if ($type->exists()) {
try {
$type->delete();
} catch (\Exception $e) {
throw new \Exception('Could not delete type ' . $type->getName() . '');
}
}
$type = new Elastica\Type($this->index, $typeName);
return $type;
}
示例4: testDeleteType
/**
* Test that Delete of index type throw deprecated exception.
*
* @group unit
* @expectedException \Elastica\Exception\DeprecatedException
*/
public function testDeleteType()
{
$type = new Type($this->getMockBuilder('Elastica\\Index')->disableOriginalConstructor()->getMock(), 'test');
$type->delete();
}
示例5: testDeleteType
/**
* Test Delete of index type. After delete will check for type mapping.
* @expectedException \Elastica\Exception\ResponseException
* @expectedExceptionMessage TypeMissingException[[elastica_test] type[test] missing]
*/
public function testDeleteType()
{
$index = $this->_createIndex();
$type = new Type($index, 'test');
$type->addDocument(new Document(1, array('name' => 'ruflin nicolas')));
$type->addDocument(new Document(2, array('name' => 'ruflin')));
$index->refresh();
$type->delete();
$type->getMapping();
}
示例6: testDeleteType
/**
* Test Delete of index type. After delete will check for type mapping.
*
* @group functional
*/
public function testDeleteType()
{
$index = $this->_createIndex();
$type = new Type($index, 'test');
$type->addDocuments(array(new Document(1, array('name' => 'ruflin nicolas')), new Document(2, array('name' => 'ruflin'))));
$index->refresh();
// sleep a moment to be sure that all nodes in cluster has new type
sleep(5);
$type->delete();
$index->optimize();
$this->assertFalse($type->exists());
}