Created
January 31, 2015 07:21
-
-
Save uedatakeshi/4856c087d105b25cc0f4 to your computer and use it in GitHub Desktop.
CakePHP3 Json output
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function initialize() | |
{ | |
parent::initialize(); | |
$this->loadComponent('RequestHandler'); | |
} | |
public function api() | |
{ | |
$this->viewClass = 'Json'; | |
$this->set('articles', $this->Articles->find()); | |
$this->set('_serialize', ['articles']); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment