@@ -45,11 +45,11 @@ class Articles extends AbstractDriver
45
45
{
46
46
47
47
/**
48
- * {@inheritDoc}
48
+ * Initialize is used to easily extend the constructor.
49
49
*/
50
50
public function initialize()
51
51
{
52
- $this->client (new Client([
52
+ $this->setClient (new Client([
53
53
'host' => 'example.com'
54
54
]));
55
55
}
@@ -63,7 +63,6 @@ class Articles extends AbstractDriver
63
63
64
64
namespace App\Webservice;
65
65
66
- use Cake\Network\Http\Client;
67
66
use Muffin\Webservice\Query;
68
67
use Muffin\Webservice\ResultSet;
69
68
use Muffin\Webservice\Webservice\Webservice;
@@ -72,11 +71,11 @@ class ArticlesWebservice extends Webservice
72
71
{
73
72
74
73
/**
75
- * {@inheritDoc}
74
+ * Executes a query with the read action using the Cake HTTP Client
76
75
*/
77
76
protected function _executeReadQuery(Query $query, array $options = [])
78
77
{
79
- $response = $this->driver ()->client ()->get('/articles.json');
78
+ $response = $this->getDriver ()->getClient ()->get('/articles.json');
80
79
81
80
if (!$response->isOk()) {
82
81
return false;
@@ -127,18 +126,19 @@ class Article extends Resource
127
126
namespace App\Controller;
128
127
129
128
use Cake\Event\Event;
129
+ use Muffin\Webservice\Model\EndpointLocator;
130
130
131
131
class ArticlesController extends AppController
132
132
{
133
133
public function initialize()
134
134
{
135
135
// You can also put this in AppController::initialize() itself
136
- $this->modelFactory('Endpoint', ['Muffin\Webservice\Model\EndpointRegistry', 'get'] );
136
+ $this->EndpointLocator = new EndpointLocator( );
137
137
}
138
138
139
139
public function beforeFilter(Event $event)
140
140
{
141
- $this->loadModel ('Articles', 'Endpoint ');
141
+ $this->EndpointLocator->get ('Articles');
142
142
}
143
143
144
144
public function index()
0 commit comments