Skip to content

Commit 01950d6

Browse files
authored
Merge pull request #71 from davidyell/readme-updates
Reflect the changes to the Cake PHP 3.6 api in the readme
2 parents 5ddab56 + a7074e8 commit 01950d6

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

README.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ class Articles extends AbstractDriver
4545
{
4646

4747
/**
48-
* {@inheritDoc}
48+
* Initialize is used to easily extend the constructor.
4949
*/
5050
public function initialize()
5151
{
52-
$this->client(new Client([
52+
$this->setClient(new Client([
5353
'host' => 'example.com'
5454
]));
5555
}
@@ -63,7 +63,6 @@ class Articles extends AbstractDriver
6363

6464
namespace App\Webservice;
6565

66-
use Cake\Network\Http\Client;
6766
use Muffin\Webservice\Query;
6867
use Muffin\Webservice\ResultSet;
6968
use Muffin\Webservice\Webservice\Webservice;
@@ -72,11 +71,11 @@ class ArticlesWebservice extends Webservice
7271
{
7372

7473
/**
75-
* {@inheritDoc}
74+
* Executes a query with the read action using the Cake HTTP Client
7675
*/
7776
protected function _executeReadQuery(Query $query, array $options = [])
7877
{
79-
$response = $this->driver()->client()->get('/articles.json');
78+
$response = $this->getDriver()->getClient()->get('/articles.json');
8079

8180
if (!$response->isOk()) {
8281
return false;
@@ -127,18 +126,19 @@ class Article extends Resource
127126
namespace App\Controller;
128127

129128
use Cake\Event\Event;
129+
use Muffin\Webservice\Model\EndpointLocator;
130130

131131
class ArticlesController extends AppController
132132
{
133133
public function initialize()
134134
{
135135
// You can also put this in AppController::initialize() itself
136-
$this->modelFactory('Endpoint', ['Muffin\Webservice\Model\EndpointRegistry', 'get']);
136+
$this->EndpointLocator = new EndpointLocator();
137137
}
138138

139139
public function beforeFilter(Event $event)
140140
{
141-
$this->loadModel('Articles', 'Endpoint');
141+
$this->EndpointLocator->get('Articles');
142142
}
143143

144144
public function index()

0 commit comments

Comments
 (0)