mirror of
https://github.com/macintoshplus/mongo-php-driver.git
synced 2026-03-29 12:22:07 +02:00
46 lines
889 B
PHP
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;
|
|
}
|
|
}
|