@@ -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
6464namespace App\Webservice;
6565
66- use Cake\Network\Http\Client;
6766use Muffin\Webservice\Query;
6867use Muffin\Webservice\ResultSet;
6968use 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
127126namespace App\Controller;
128127
129128use Cake\Event\Event;
129+ use Muffin\Webservice\Model\EndpointLocator;
130130
131131class 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