Files
mongo-php-driver/old-docs/api/MongoDB/GeneratedId.php
2014-12-03 15:47:58 -08:00

46 lines
889 B
PHP

<?php
namespace MongoDB;
/**
* Value object for a document identifier that was generated by the driver or
* server during an upsert operation, respectively.
*/
final class GeneratedId
{
private $id;
private $index;
/**
* Constructs a new GeneratedId
*
* @param mixed $id Document identifier
* @param integer $index Batch index of the corresponding operation
*/
public function __construct($id, $index)
{
$this->id = $id;
$this->index = (integer) $index;
}
/**
* Returns the GeneratedId
*
* @return mixed Document identifier
*/
public function getId()
{
return $this->id;
}
/**
* Returns the batch index
*
* @return integer Batch index of the corresponding operation
*/
public function getIndex()
{
return $this->index;
}
}