Basho\Riak\Command\Builder\StoreObject::build PHP Method

build() public method

public build ( ) : Basho\Riak\Command\Object\Store
return Basho\Riak\Command\Object\Store
    public function build()
    {
        $this->validate();
        return new Command\Object\Store($this);
    }

Usage Example

 /**
  * Tests that attempting to store an object generates headers for any
  * 2i entries on the object.
  */
 public function testStoreObjectWithIndexGeneratesHeaders()
 {
     $inputHeaders = [Http::METADATA_PREFIX . 'My-Header' => 'cats', 'x-riak-index-foo_bin' => 'bar, baz', 'x-riak-index-foo_int' => '42, 50'];
     $builder = new Command\Builder\StoreObject(static::$riak);
     $builder->buildObject('some_data', $inputHeaders);
     $builder->buildBucket('some_bucket');
     $command = $builder->build();
     $this->assertInstanceOf('Basho\\Riak\\Command\\Object\\Store', $command);
     $this->assertArrayHasKey('My-Header', $command->getObject()->getMetaData());
     $this->assertEquals($command->getObject()->getMetaData()['My-Header'], 'cats');
     $this->assertArrayHasKey('foo_bin', $command->getObject()->getIndexes());
     $this->assertCount(2, $command->getObject()->getIndex('foo_bin'));
     $this->assertArrayHasKey('foo_int', $command->getObject()->getIndexes());
     $this->assertCount(2, $command->getObject()->getIndex('foo_int'));
 }
All Usage Examples Of Basho\Riak\Command\Builder\StoreObject::build