lithium\data\source\Http::read PHP Method

read() public method

Read used by model to GET.
public read ( object $query, array $options = [] ) : string
$query object
$options array
return string
    public function read($query, array $options = array())
    {
        $query = !is_object($query) ? new Query() : $query;
        $query->method() ?: $query->method("get");
        $query->path() ?: $query->path("/{:source}");
        return $this->_filter(__METHOD__, array($query, $options), function ($self, $params) {
            list($query, $options) = $params;
            return $self->send($query, $options);
        });
    }

Usage Example

Beispiel #1
0
 public function testReadWithModelConditions()
 {
     $http = new Http($this->_testConfig);
     $query = new Query(array('model' => $this->_model, 'conditions' => array('page' => 2)));
     $result = $http->read($query);
     $expected = join("\r\n", array('GET /posts?page=2 HTTP/1.1', 'Host: localhost:80', 'Connection: Close', 'User-Agent: Mozilla/5.0', '', ''));
     $result = (string) $http->last->request;
     $this->assertEqual($expected, $result);
 }
All Usage Examples Of lithium\data\source\Http::read