Working with Database Replications in CakePHP

2377be1c3f33751ea7c73a7bd8d58996?s=47 T. MOTOOKA
November 09, 2019

Working with Database Replications in CakePHP

9 Nov 2019
CakeFest 2019 in Tokyo, Japan

2377be1c3f33751ea7c73a7bd8d58996?s=128

T. MOTOOKA

November 09, 2019
Tweet

Transcript

  1. 21.

    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')); }