Created
August 15, 2015 09:39
-
-
Save ikuwow/93992048d44712819cc8 to your computer and use it in GitHub Desktop.
CakePHP2でのElementキャッシュで見た目から処理を減らしていく ref: http://qiita.com/ikuwow/items/bf2e0e4c2ca289a3655d
This file contains hidden or 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
$this->Element('user_ranking', [], [ | |
'cache' => true | |
]); |
This file contains hidden or 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
$ranking = $this->requestAction([ | |
'controller' => 'Users', | |
'action' => 'getUserRanking' | |
]); |
This file contains hidden or 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 getUserRanking() { | |
if ($this->request->is('requested')) { | |
// requestAction()時のみrankingを返す | |
return $this->UserRanking->getUserRanking(); | |
} | |
throw new BadRequestException(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment