Elastica\Bulk::hasType PHP Method

hasType() public method

public hasType ( ) : boolean
return boolean
    public function hasType()
    {
        return null !== $this->getType() && '' !== $this->getType();
    }

Usage Example

Ejemplo n.º 1
0
 /**
  * @group functional
  */
 public function testSetIndexType()
 {
     $client = $this->_getClient();
     $index = $client->getIndex('index');
     $type = $index->getType('type');
     $index2 = $client->getIndex('index2');
     $type2 = $index2->getType('type2');
     $bulk = new Bulk($client);
     $this->assertFalse($bulk->hasIndex());
     $this->assertFalse($bulk->hasType());
     $bulk->setIndex($index);
     $this->assertTrue($bulk->hasIndex());
     $this->assertFalse($bulk->hasType());
     $this->assertEquals('index', $bulk->getIndex());
     $bulk->setType($type2);
     $this->assertTrue($bulk->hasIndex());
     $this->assertTrue($bulk->hasType());
     $this->assertEquals('index2', $bulk->getIndex());
     $this->assertEquals('type2', $bulk->getType());
     $bulk->setType($type);
     $this->assertTrue($bulk->hasIndex());
     $this->assertTrue($bulk->hasType());
     $this->assertEquals('index', $bulk->getIndex());
     $this->assertEquals('type', $bulk->getType());
     $bulk->setIndex($index2);
     $this->assertTrue($bulk->hasIndex());
     $this->assertTrue($bulk->hasType());
     $this->assertEquals('index2', $bulk->getIndex());
     $this->assertEquals('type', $bulk->getType());
 }