Ejemplo n.º 1
0
 /**
  * Read a new model from the web service using the specified primary key.
  *
  * @param int|string $key
  * @return Model
  */
 public function read($key)
 {
     // This is intentionally not strict. The API considers an
     // integer 0 to be null and will respond with a fault.
     if ($key == null) {
         return null;
     }
     $response = $this->client->readObject($this->type, $key);
     if (empty($response)) {
         return null;
     }
     $model = $this->newInstance($response);
     $model->exists = true;
     return $model;
 }