Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Working with Database Replications in CakePHP

T. MOTOOKA
November 09, 2019

Working with Database Replications in CakePHP

9 Nov 2019
CakeFest 2019 in Tokyo, Japan

T. MOTOOKA

November 09, 2019
Tweet

More Decks by T. MOTOOKA

Other Decks in Technology

Transcript

  1. 3FQMJDBUJPO-BH // Controller public function add() { $article = $this->Articles->newEntity();

    if ($this->request->is('post')) { $article = $this->Articles->patchEntity($article, $this->request->getData()); if ($this->Articles->save($article)) { $this->Flash->success(__('Your article has been saved.')); return $this->redirect(['action' => 'index']); } .... } public function index() { // use ReadReplica for this action $this->Articles->changeConnectionToReadReplica(); $articles = $this->Paginator->paginate($this->Articles->find()); $this->set(compact('articles')); }