PHP code example of burzum / cakephp-service-layer
1. Go to this page and download the library: Download burzum/cakephp-service-layer library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
burzum / cakephp-service-layer example snippets
use Burzum\CakeServiceLayer\Service\ServiceAwareTrait;
class AppController extends Controller
{
use ServiceAwareTrait;
}
class FooController extends AppController
{
public function initialize()
{
parent::initialize();
$this->loadService('Articles');
}
/**
* Get a list of articles for the current logged in user
*/
public function index()
{
$this->set('results', $this->Articles->getListingForUser(
$this->Auth->user('id')
$this->getRequest()->getQueryParams()
));
}
}
// Loads BarService from MyPlugin and src/Service/Foo/
$this->loadService('MyPlugin.Foo/Bar');