Exemplo n.º 1
0
 /**
  * Check now if we have an index.
  * 
  * @param mixed	 $body		Setter mode.
  * @return array			Getter mode : the body.
  * @throws Simples_Request_Exception 
  */
 public function body($body = null)
 {
     if (!isset($body) && !isset($this->_options['index'])) {
         throw new Simples_Request_Exception('Empty key "index" : you should specify the index name !');
     }
     return parent::body($body);
 }
Exemplo n.º 2
0
 /**
  * Path : id management.
  *
  * @return string    API path
  */
 public function path()
 {
     $path = parent::path();
     // Object id transmited : we add it to the url.
     if (isset($this->_body['id'])) {
         $path->directory($this->_body['id']);
     }
     return $path;
 }
Exemplo n.º 3
0
 /**
  * Path : id management.
  *
  * @return string	API path
  */
 public function path()
 {
     if ($this->bulk()) {
         $path = new Simples_Path('_bulk');
         if ($this->definition()->inject('params')) {
             $path->params($this->params());
         }
     } else {
         $path = parent::path();
         // Object id transmited : we had it to the url.
         if (isset($this->_options['id'])) {
             $path->directory($this->_options['id']);
         } elseif ($this->_body instanceof Simples_Document) {
             if ($this->_body->id) {
                 $path->directory($this->_body->id);
             } elseif ($this->_body->properties() && $this->_body->properties()->id) {
                 $path->directory($this->_body->properties()->id);
             }
         }
     }
     return $path;
 }
Exemplo n.º 4
0
 /**
  * Specific response object.
  * 
  * @param array		$data		Search request results.
  * @return \Simples_Response_Search 
  */
 protected function _response($data)
 {
     return new Simples_Response_Search($data, parent::options());
 }