$command = (new Command\Builder\StoreObject($riak)) ->buildObject('{"firstName":"John","lastName":"Doe","email":"johndoe@gmail.com"}') ->buildBucket('users') ->build(); $response = $command->execute(); $user_location = $response->getLocation();
Inheritance: extends Basho\Riak\Command\Builder, implements Basho\Riak\Command\BuilderInterface, use trait ObjectTrait, use trait Basho\Riak\Command\Builder\LocationTrait
 /**
  * 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'));
 }
 /**
  * Tests that attempting to store an object generates headers for any
  * 2i entries on the object.
  *
  * @dataProvider getLocalNodeConnection
  *
  * @param $riak \Basho\Riak
  */
 public function testStoreObjectWithIndexGeneratesHeaders($riak)
 {
     $inputHeaders = ['My-Header' => 'cats', 'x-riak-index-foo_bin' => 'bar, baz', 'x-riak-index-foo_int' => '42, 50'];
     $builder = new Command\Builder\StoreObject($riak);
     $builder->buildObject('some_data', $inputHeaders);
     $builder->buildBucket('some_bucket');
     $command = $builder->build();
     $this->assertInstanceOf('Basho\\Riak\\Command\\Object\\Store', $command);
     $headers = $command->getHeaders();
     $this->assertNotNull($headers);
     $this->assertEquals(5, count($headers));
     $this->assertEquals(['My-Header', 'cats'], $headers[0]);
     $this->assertEquals(['x-riak-index-foo_bin', 'bar'], $headers[1]);
     $this->assertEquals(['x-riak-index-foo_bin', 'baz'], $headers[2]);
     $this->assertEquals(['x-riak-index-foo_int', '42'], $headers[3]);
     $this->assertEquals(['x-riak-index-foo_int', '50'], $headers[4]);
 }