Beispiel #1
0
 /**
  * @return \Google_Service_Datastore_ReadOptions
  * @throws MissingFieldsException
  * @throws ReadOptionsException
  */
 public function build()
 {
     if ($this->readConsistency === null && $this->transaction === null) {
         throw new MissingFieldsException(self::class, ['$readConsistency or $transaction']);
     }
     if ($this->readConsistency !== null && $this->transaction !== null) {
         throw new ReadOptionsException('Read consistency cannot be set when transaction is set');
     }
     $readOptions = new \Google_Service_Datastore_ReadOptions();
     if ($this->transaction !== null) {
         $readOptions->setTransaction($this->transaction);
     }
     if ($this->readConsistency !== null) {
         $readOptions->setReadConsistency($this->readConsistency->value());
     }
     return $readOptions;
 }