ããã«ã¡ã¯ããµã¼ãã¼ãµã¤ããã£ã¦ããã¾ã éå (@o0h_)ã§ãã
ãªãã¨ãªããããKindleã®ã©ã¤ãã©ãªãè¦ã¦ããããã¹ãã¨ã³ãã£ã¢ããã£ã¦ãã¨ã¦ãç¾ããã¦è¯ã話ã ãªãããããã¨æã£ã次第ã§ãã
ã¹ãã¨ã³ãã£ã¢ (ããã°ã³ããã¯ã¹ã¹ãã·ã£ã«)
- ä½è : æ¸ç°èª äº
- åºç社/ã¡ã¼ã«ã¼: å°å¦é¤¨
- çºå£²æ¥: 2014/06/16
- ã¡ãã£ã¢: Kindleç
- ãã®ååãå«ãããã°ãè¦ã
ãã¦ãæ²é¡ã®ã¨ããã§ããã以åã«ãããªã®ãã¹ããã¢ã¼ã·ã§ã³ãå®æ½ããéã®è² è·å¯¾çã¨ãã¦ä½æããæ©æ§ããã©ã°ã¤ã³ã¨ãã¦å
¬éãã¾ããã
ã»ã»ã»ã¨ããæ¸ãåºãã§ä»¥åã«æ¸ããã®ããCakePHP2.xç¨ã®Master/Replicaæ¥ç¶ç®¡çãã©ã°ã¤ã³ã§ãã
ããããæ«ãçµã¡ã¾ãããããã®åº¦CakePHP3ç¨ã®åæ§ã®ãã©ã°ã¤ã³ãå ¬éãã¾ããã
ãã®è¨äºã§ã¯ã以ä¸ã®3ç¹ã«ã¤ãã¦ç´¹ä»ãããã¨æãã¾ãã
- ãã©ã°ã¤ã³ã®å©ç¨æ¹æ³ã«ã¤ãã¦ã®ç°¡åãªèª¬æ
- è¨è¨ã«ã¤ãã¦
- ãCakePHP3.xã®ãã©ã°ã¤ã³ããå ¬éããéã«å·¥å¤«ãããã¨
- â å©ç¨æ¹æ³ã«ã¤ãã¦
- â¡è¨è¨ã«ã¤ãã¦
- â¢ãCakePHP3.xã®ãã©ã°ã¤ã³ããå ¬éããéã«å·¥å¤«ãããã¨
- æå¾ã«
â å©ç¨æ¹æ³ã«ã¤ãã¦
CakePHP2ç¨ã®ãã©ã°ã¤ã³ã¨åæ§ã«ããè¤æ°ã®æ¥ç¶ã管çããããåä¸ã®ã¢ãã«ããããããä»»æã«ä½¿ãåããããããã¨ãç®çã¨ãã¦ãã¾ããä¾ãã°ãåç §ããèµ°ããªããªã¯ã¨ã¹ãã¯åç §ç¨DBã«æ¥ç¶ãã¦ãæ´æ°ç³»ã¯ãã¹ã¿ã¼DBã«æ¥ç¶ãããã¨ãã£ããããªä½¿ãæ¹ãæ³å®ãã¦ãã¾ãã
ç°¡åã«å©ç¨æ¹æ³ãç´¹ä»ãã¾ãã
- Pluginãcomposer installã§å°å ¥ãã
- ãè¤æ°ã®æ¥ç¶å ããconfig(ããã©ã«ãã§ã¯config/app.php)ã«æ¸ãè¾¼ã
- (Controllerçã§)å¿ è¦ã«å¿ãã¦æ¥ç¶å æ å ±ãå¤æ´ããã¡ã½ãããå®è¡ãã
1. Pluginã®é ç½®
Composerã«ããinstallã«å¯¾å¿ãã¦ãã¾ãã
composer require connehito/cakephp-master-replica
åä½ã¯ã©ã¹ã®åå空é解決ã«ããèªã¿è¾¼ã¿ã ãã§ååãªã®ã§ãPluginã®ãã¼ãçã®å¦çã¯å¿ è¦ã¨ãã¾ããã
2. æ¥ç¶æ å ±ã®è¨å®
ConnectionManagerã«å°ãããè¨å®ãå¤æ´ãã¾ãã
æ¨æºçãªæ§æã§ã¯ããã㯠config/app.php
ã«ãã Datasources
ã®å
容ã¨ãªãã¾ãã
é常ã®Connectionã¯ã©ã¹ç¨ã®è¨å®ã¨åæ§ã«è¨è¿°ãããã¨ã«ããæ¥ç¶å
ã®å·®åãã roles
ã«æ¸ãè¾¼ãã§ãã ããã
å
±éããæ¥ç¶æ
å ±ãè¨è¿°ããä¸ã§ãããããã®æ¥ç¶å
ãã¨ã«ç°ãªãé¨åãè¨è¿°ããããã«ãªãã¾ãã
ä¾ãã°ã以ä¸ã®ãããª3ã¤ã®æ¥ç¶å
ãæ±ãããã¨ããéè¦ããã£ãã¨ãã¾ã*1
(MySQLã使ããã®ã¨ãã¾ã)
- master
- Host: db-host
- DB: app_db
- Username: root
- Password: password
- replica(1)
- Host: db-host
- DB: app_db
- Username: read-only-user
- Password: another-password
- replica(2)
- Host: replica-host
- DB: app_db
- Username: read-only-user
- Password: another-password
ããã«ãmasteræ¥ç¶ã ãå©ç¨ãããå ´åã¯ãCakePHPæ¨æºã®Connectionãå©ç¨ãã¦ä»¥ä¸ã®ããã«è¨è¿°ã§ãããã¨æãã¾ãã
<?php // config/app.php use Cake\Database\Connection; use Cake\Database\Driver\Mysql; return [ 'Datasources' => [ 'default' => [ 'className' => Connection::class, 'driver' => Mysql::class, 'persistent' => false, 'host' => 'db-host', 'username' => 'root', 'password' => 'password', 'database' => 'app_db', 'timezone' => 'UTC', 'flags' => [], 'cacheMetadata' => true, 'log' => false, 'quoteIdentifiers' => false, ], ], ];
ããããmaster + replica + replica2ã¨ããæ§æã«å¯¾å¿ã§ããããã«æ¸ãæãã¦ã¿ã¾ã
<?php // config/app.php use Cake\Database\Driver\Mysql; use Connehito\CakephpMasterReplica\Database\Connection\MasterReplicaConnection; return [ 'Datasources' => [ 'default' => [ 'className' => MasterReplicaConnection::class, 'driver' => Mysql::class, 'persistent' => false, 'host' => 'db-host', 'database' => 'app_db', 'timezone' => 'UTC', 'flags' => [], 'cacheMetadata' => true, 'log' => false, 'quoteIdentifiers' => false, 'roles' => [ 'master' => [ 'username' => 'root', 'password' => 'password', ], 'replica' => [ 'username' => 'read-only-user', 'password' => 'another-password', ], 'replica2' => [ 'host' => 'replica-host', 'username' => 'read-only-user', 'password' => 'another-password', ], ], ], ], ];
ãã®ããã«ãclassNameãMasterReplicaConnection
ã«æ¸ãæããä¸ã§ãå·®åã ãroles
ã«æ¸ãããã¨ã«ãã£ã¦å
¨ã¦ã®æ¥ç¶ãæ±ããããã«ãªãã¾ãã
3. æ¥ç¶ã®åãæ¿ã
ããã©ã«ãã§ã¯ã master
ã¨ããååã®è¨å®ãç¨ãã¦æ¥ç¶ããã¾ãã
switchRole()
ã¨ããAPIãç¨ãã¦ç°¡åã«æ¥ç¶å
ãåãæ¿ãããã¨ãå¯è½ã§ãã
ä¾ãã°Tableã¤ã³ã¹ã¿ã³ã¹ãæå ã«ããå ´åã¯ãTableã¤ã³ã¹ã¿ã³ã¹ãä»ãã¦ã¢ã¯ã»ã¹ããã®ãæ軽ã ã¨æãã¾ãã
<?php $this->UsersTable->getConnection()->switchRole('replica');
ãã以å¤ã®å ´åã¯ãConnectionManagerãå©ç¨ãããã¨ã«ãªãã§ããããã
<?php use \Cake\Datasource\ConnectionManager; ConnectionManager::get('default')->switchRole('replica2');
æ¯è¼ç容æã«ã¢ã¯ã»ã¹ãã§ããã®ã§ããªãã©ã¤æ©æ§ã®å°å ¥ãå±æçã«ã¢ã¯ã»ã¹å ãå¤æ´ãããã¨ãããã¼ãºã«ã対å¿ãç°¡åã§ãã
4. çºå±çãªå©ç¨ä¾: CQRSçãªãã®
å¤ãã®Webã¢ããªã±ã¼ã·ã§ã³ã§ããæ¸ãè¾¼ã¿ã»æ´æ°ãä¼´ããã¼ã¸ãã¨ã³ããã¤ã³ãããåç
§ããç¨ããªããã®ãã¨ããã®ãæ¯è¼çã¯ã£ããã¨åãããã®ã§ã¯ãªãã§ããããã
ã¨ã³ããã¤ã³ãåä½ãããããCommand/Queryçã«åé¡ããããããã§æ¥ç¶å
ãè¨å®ã§ããã¨å®ç¨ã§ããå ´é¢ãåºããããã«æãã¾ãã
社å
ã®ãããã¯ãã§ã¯ãRoutingã®è¨å®ã¨çµ¡ãã¦ãã©ã£ã¡ã«ã¤ãªããããã管çã§ããããã«ãã¾ããã
ä¾ãã°ãååã®åå¥ãã¼ã¸ãã¨ãã¦ã item/show
ã¨ããã¨ã³ããã¤ã³ãããããããã§ã¯DBã®æ´æ°ãèµ°ããªããã®ã¨ãã¾ããitem/edit
ã§ã¯æ
å ±ã®æ´æ°ãè¡ããããDBã®æ´æ°ãè¡ãã¾ãã
ã¾ãã routes.phpã§ã¨ã³ããã¤ã³ãåå¥ã®è¨å®ã¨ãã¦ç¬èªã®ãªãã·ã§ã³ã§ããreadOnly
ãã©ã°ãç«ã¦ã¾ãã
<?php //routes.php $routes->scope('item/', ['controller' => 'Items'], function (RouteBuilder $routes) { $routes->connect( 'show', [ 'action' => 'show', '_method' => 'GET', ] ); $routes->connect( 'edit', [ 'action' => 'edit', '_method' => 'POST', 'readOnly' => false, ] ); });
ã«ã¼ãã£ã³ã°æ
å ±ã¨ä¸ç·ã«æ¸¡ã£ã¦ããå
容ã«å¯¾ãã¦ã AppController::beforeFilter()
ãªã©ã®ãæåã®æ¹ã«éãå
±éå¦çãã§è¨å®ãåæ ããã¾ãã
<?php /** * routesãããã©ã¡ã¼ã¿ãèªã¿åããæ¥ç¶å ã®DBãåãæ¿ãã * * @return void */ private function setDefaultDbRole() { $readOnly = $this->getRequest()->getParam('readOnly', true); $dbRole = readOnly ? 'replica' : 'master'; /** @var MasterReplicaConnection $connection */ $connection = ConnectionManager::get('default'); $connection->switchRole($dbRole); }
ããã ãã§ããæ示çã«readOnlyãã©ã°ãæã£ãã¨ã³ããã¤ã³ã以å¤ã¯ã¬ããªã«ãè¦ããæ©è½ãå®ç¾ããã¾ããã
â¡è¨è¨ã«ã¤ãã¦
ããããã¯ãå®è£ é¢ã®è©±ãç´¹ä»ããã¦ããã ãã¾ãã
CakePHP3ã®ãORMããDBæ¥ç¶ã
CakePHP2ã¨æ¯ã¹ã¦3.xã¯ãORMå¨ãã®æ©è½ãå¤§å¹ ã«å¼·åã»å¤æ´ããããã¨ããã®ã¯ä¸»è¦ãªãããã¯ã®1ã¤ã§ãããORM/Databaseå¨ãã«é¢ããå é¨æ§é ãè¤éã«ãªã£ã¦ãã¾ãã
主è¦ãªç»å ´äººç©ã¨ãã¦ãORMããDatasourceããDatabaseãã®3ã¬ã¤ã¤ã¼ãåºã¦ãã¾ãã
ãã£ã¨ã¾ã¨ããã¨ä»¥ä¸ã®ããã«ãªãã¾ãã
é常ã®ã¢ããªã±ã¼ã·ã§ã³éçºãé²ãã¦ããæã«ç´æ¥è§¦ãã®ã¯ORM層ã®ã¿ã§ãã»ã¼äºè¶³ããã¨æãã¾ãã
ãã®è¨äºã§ã¯è©³ç´°ã«ã¤ãã¦ã¯å²æãã¾ã*2ãããConnectionãã¨ãDriverãã«çç®ãã¦ãã ãã
Driverã¯ã©ã¹ã¯ãClassDocãè¦ãã¨ä»¥ä¸ã®ãããªãµããªã¼ãã¤ãã¦ãã¾ãã
/** * Represents a database driver containing all specificities for * a database engine including its SQL dialect. */
(cakeã®ä¸ã§ã¯)ãããæãDBã«è¿ã層ã§ãPDOã¤ã³ã¹ã¿ã³ã¹ãä¿æãã¾ãã
Connectionã¯ã©ã¹ã¯ãããã使役ããã¯ã©ã¹ã§ãDriverãçæã»åå¾ãä¿æãã¾ãã
ä»åä½æãããã£ãã®ã¯ãè¤æ°ã®æ¥ç¶å
ã管çãããæ©è½ãªã®ã§ããæ¥ç¶ãåãæ¿ãããå ´ã¨ãã¦Connectionã¯ã©ã¹ãæ¹å¤ãããã¨ã«ãã¾ããã
æ¥ç¶ã®çæã¨ç®¡çã»åãæ¿ã
PHPä¸ã§å®éã«ãDBã«æ¥ç¶ãã¦ãããã®ã¯ãPDOã¤ã³ã¹ã¿ã³ã¹ãçæ(ä¿æ)ãã¦ãããç®æã«ãªãã¾ãã
å½ãã©ã°ã¤ã³ = Connectionã¯ã©ã¹ã§ã¯ããã¯ã©ã¹ã®ã¤ã³ã¹ã¿ã³ã¹åæã«ã注å
¥ããã¦ããå
¨ã¦ã®è¨å®ã«å¿ãã
PDOã¤ã³ã¹ã¿ã³ã¹(ã¨ã®ä»²ä»å½¹ã§ããDriverã¤ã³ã¹ã¿ã³ã¹)ãçæããä¿æãããã¨ããæ¦è¡ãåãã¾ããã
CakePHP2ç¨ãã©ã°ã¤ã³ã§ã¯ãDatasource\Databaseã¬ã¤ã¤ã¼ã¸ã®ããã¯ãè¡ãMysqlãåæã¨ãã¦ãã¾ããããã®ããã«PDOã¨ãå¯çµåã«ãªã£ã¦ãã¾ãã
ããã«å¯¾ãã¦CakePHP3ç¨ã®ãã©ã°ã¤ã³ã§ã¯ãæ¥ç¶ç®¡çãæ½è±¡åããããã¨ã§ãé度ãªè¨è¨ãå¿
è¦ã¨ããã«æ¥ç¶ç¨ã®DBãã©ã¤ãã¯ä»ãæ¿ãå¯è½ã§ãããã®ç¹ã«æ³¨ç®ãã¾ããã
ãã¡ãªããã¨ãã¦ã¯ãä¾ãã°ãreplicaæ¥ç¶ãã使ããªãã®ã«masteræ¥ç¶ã®ã¤ã³ã¹ã¿ã³ã¹ãçæããã¦ãã¾ããã¨ãã£ããªã¼ãã¼ããããããã¾ãã
å®éãå½åã¯ãå¼ã³åºãããæç¹ã§PDOã¤ã³ã¹ã¿ã³ã¹ãä½ããä¸è¦ã«ãªã£ããç ´æ£ãããã¨ããæ¹æ³ãå®ç¾ã§ãããï¼ã¨æ¨¡ç´¢ããã¾ããã
çæèªä½ã¯é
延èªã¿è¾¼ã¿çã«çæããã°å®ç¾ã§ããããªæ°ã¯ãã¾ããåé¡ã¯ãç ´æ£ãããã¿ã¤ãã³ã°ã§ãããã©ã³ã¶ã¯ã·ã§ã³ç®¡çãªã©ãã©ããã¦ããDriverãªããConnectionããåãåããªããã°ãããªãé¢å¿äºãå¢ããããã¨ã§ãå®è£
ä¸ã®è¤éããå¢ããããªæ¸å¿µãããã¾ãããã¾ãããå¼ã³åºããããã³ã«åæ¥ç¶ããããã¨ã§çããDBæ¥ç¶ç¢ºç«ã¯å¤§ããªè² æ
ã«ãªãããã§ãã
ç·åãã¦ããæ¥ç¶ããã®ã¯æåã«æ¸ã¾ãã¦ãã¾ãããã¤ã³ã¹ã¿ã³ã¹ãå é¨ã«ä¿æãç¶ããããã¨ã§å¾ããããã·ã¹ãã ãªã½ã¼ã¹çã«ãã¢ããªã±ã¼ã·ã§ã³ã³ã¼ãçã«ãé åãæãã¾ããã ã¾ãããããã®æ©è½ããã£ã70è¡ã¡ãã£ã¨ã®åä¸ã¯ã©ã¹ã§å®ç¾ã§ããã¨ããã®ã¯ãç°¡æ½ãªè¨è¿°ãã§ãããææã ã¨ãè¨ããã®ã§ã¯ãªãã§ããããã
â¢ãCakePHP3.xã®ãã©ã°ã¤ã³ããå ¬éããéã«å·¥å¤«ãããã¨
å½ãã©ã°ã¤ã³ã¯ãå
ã
ãããã¯ãã³ã¼ãã®ä¸é¨ã¨ãã¦å®è£
ãã¦ãããã®ãã©ã¤ãã©ãªã¨ãã¦åãåºãããã®ã§ãã
å®éã®ãããã¯ããªããã³ã³ããã¼ã©ã¼ããã¼ã¿ãã¼ã¹ããã¹ã¦ãæã£ã¦ããï¼ããã¹ãç°å¢ãããã®ã§ãããã¹ã¿ã³ãã¢ãã³ãªã©ã¤ãã©ãªã§ã¯ããããè¡ãã¾ãããç°å¢æ§ç¯ãå«ãäºåæºåã¯æ¬è³ªçã§ã¯ãªãã¹ãã¬ã¹ã«ãªãã¨èãã¦ãã¾ãããããã¹ããããã«å®è¡ã§ããã°ãã©ãã ãéçºä½é¨ãè¯ããªããã»ã»ã»ã»
ãã®åé¡ã¯å人çã«ã¯æ¯åé ãæ±ããé¨åãªã®ã§ãèªåãªãã«ãããããã楽ããªï¼ãã¨æãã工夫ãããã¤ãæ½ãã¦ã¿ã¾ããã
ãªããä»ããªã試è¡é¯èª¤ãã¦ããé¨åãªã®ã§ããã²çããã®ãæè¦ãèãã¦ã¿ããã§ãã
docker-composeã®æ¢±å
ãã®ãã©ã°ã¤ã³ã¯çå±ä¸ã¯DBã使ããªãã¦ãå®è£
ãããã¸ãã¯ã®å
容ãæ¤æ»ãå¯è½ã ã¨æãã¾ããããããªãããDBå¨ãã®æ©è½ãæä¾ãããã®ã§ãããããããã¹ãã®æç¹ã§ãå®éã«DBã«è§¦ã£ã¦ã¿ããäºãã§ããã¨å®å¿ã§ãã
ããã§ãdocker-composeãç¨ãã¦PHP+MySQLã®éçºåå°ãé
å¸ã§ããããã«ãã¾ããã
(sourceã¯ã³ãã©)
ããã«ãã£ã¦ãä¾ãã°PhpStormã¦ã¼ã¶ã¼ã§ããã°æ軽ã«IDEä¸ããã®ãã¹ãå®è¡ãæä¾ã§ãããã¨ã«ãªãã¾ãð
- stormã®è¨å®
- å®éã«ãã¹ããå®è¡ãã¦ããå
æ¯ð»
(localã®)ãã¹ãæã«ãã¼ã«ã«ãããã©ã°ã¤ã³ãèªã¿è¾¼ã
Composeré
å¸åæã®ã©ã¤ãã©ãªãªã®ã§ãæçµçã«ã¯packagistçµç±ã§å°ããããã¨ã«ãªãã¾ããããããéçºä¸ã¯ããããpushããã¨ããã®ã¯é¢åãªè©±ã§ãã
ããã§ã docker-composeã®volumesã¨(ãã¹ãå®è¡å´ã¢ããªã®)composer.jsonãçµã¿åããããã¨ã§ãããã¹ãå®è¡æã«ãã¼ã«ã«ããã©ã¤ãã©ãªãèªã¿è¾¼ããããã«ãã¾ããã
ãã¹ãããDockerã³ã³ããã«ã©ã¤ãã©ãªã®srcãå°ããã
å ¨ä½æ§æã¨ãã¦ã¯
src
: ã©ã¤ãã©ãªæ¬ä½tests/test_app/composer.json
: ãã¹ãå®è¡ã¢ããªã®composer.jsontests/test_app/docker-compose.yaml
: ãã¹ãå®è¡ã¢ããªã®docker-compose
ã¨ãªãã¾ãã
docker-composeä¸ã§ã¯ã次ã®ããã«ãã¦ãPJå
¨ä½ã¯ /app
ã«å°ãããããããã¨ã¯å¥ã«ã /dist
ä¸ã«ã©ã¤ãã©ãªã®æ¬ä½ã¨ããã±ã¼ã¸æ
å ±(composer.json)ãå°ããããããã«ãã¾ãã
services: test-app: volumes: - ../../src:/dist/src - ../../composer.json:/dist/composer.json - ../..:/app
ãã¼ã«ã«ã®ãã¹ãã¬ãã¸ããªã¨ãã¦è¨å®ãã
composer.jsonä¸ã«ã¯ããã¼ã«ã«ã®ããã±ã¼ã¸ãåç §ãããããã«ã¬ãã¸ããªæ å ±ã追å ãã¾ã
"repositories": [ { "type": "path", "url": "/dist" } ],
ããã§ã app/tests/test_app/vendor/connehito/cakephp-master-replica
㯠/dist
ãæãã·ã³ããªãã¯ã«ãªãã¾ãð
CakePHP4ãè¦æ®ãã¦ã»ã»
次æãã¼ã¸ã§ã³ã§ããCakePHP4ã¯ããã§ã«Î²4ã¾ã§é²ãã§ããã段ã
ã¨å
¨è²ãè¦ãã¦ãã¦ãã¾ãã
CakePHP3ã¨ã®äºææ§ã«ã¤ãã¦ã¯æèããã¦ããã¨ãããã¨ã§ãcakephp-master-replicaãã©ã°ã¤ã³ã«ããã¦ãå¯è½ã§ããã°ä½ã³ã¹ãã«ç§»è¡ãããã¨èãã¦ãã¾ãã
ããã§ã4.xããå
¥ãè¦ç´çã¸ã®å¯¾å¿ãå®æ½ãã¾ããã
主ã ã£ãã¨ããã§ã¯ä»¥ä¸ã®4ç¹ã§ã
- cakephp-codesnifferãå©ç¨ãã¦PSR-12対å¿
- å³å¯ãªåãã§ãã¯(strict_types=1)
- å¼æ°ã»æ»ãå¤ã®å宣è¨
- PHPStanã®å¯¾å¿ã¬ãã«å¼ãä¸ã(Lv5)
strict_typesã®å®£è¨æ¼ãã«ã¤ãã¦ã¯codesnifferã§ãã§ãã¯ã§ããã®ã§ãããã¾ã§ãã¼ãã¹ã«ãªãå¿
è¦ãããã¾ãã(CIã§ã³ã±ããã)ã
PHPStanã®ã¬ãã«ã«ã¤ãã¦ã¯ãã³ã¼ãã£ã³ã°è¦ç´ãã¨ã¯ç°ãªãããã«ãæãã¾ãããæ¬ä½ã®ååã«è¿½å¾ãããã¨ãããã®ã§ãã
æçµçã«ã¯stableã®ãªãªã¼ã¹ãå¾
ã£ã¦ç§»è¡ã¬ã¤ãä»ããã¥ã¡ã³ãããã§ãã¯ã対å¿ãããã¨ã«ãªãã¾ãããä»ã®æç¹ã§ã®ãå¤æ´ç¹ãã¨ãã¦ã¯ãããªãã®ã ã¨æã£ã¦ãã¾ãã
æå¾ã«
ããå
ããªã³ã¼ãã§æ©è½ãå®ç¾ã§ããã®ã¯ãããã¬ã¼ã ã¯ã¼ã¯ã«ä¹ã£ãã£ãæ¨å³ã ãã¨æãã¦ãã¾ãï¼
ã¾ããå®ç¾ãããã³ã¼ããå¦ä½ã«ãã¦ãã£ããããããï¼ã¨ãã観ç¹ã§ã®ã³ã¼ããªã¼ãã£ã³ã°ã¯ãã¢ããã¼ã·ã§ã³ã湧ããããè¯ããã®ã§ããä»åã®æ©æ§ã®éçºã«ããããèªåãªãã«CakePHP3ã®ORM,Databaseã¬ã¤ã¤ã¼ã«ã¤ãã¦ç解ãæ·±ã¾ãã¾ããã
PDOã¤ã³ã¹ã¿ã³ã¹ãè¤æ°æãããã¨ããã¢ã¤ãã£ã¢èªä½ã«ã¤ãã¦ããçµæçã«Illuminateã®æ¥ç¶ç®¡çã§ãåæ§ã®ææ³ãåã£ã¦ãããã®ã§ããã»ã»ã»ãã£ã¨ããããã¯å®è£ ãã¦ããæ°ã¥ããã®ã§ãããã£ã¨æ©ãè¦ãã°ããã£ããã¨é åãããã¾ãããããå人çã«ã¯ãæªããªãããæ¹ã¨æã£ã¦ããã®ããªãããã¨ãåæã«èªä¿¡ãæ·±ããããã¨è¨ãã¾ãâ¨Illuminateã®æ¹ãé«æ©è½ãªå®è£ ããã¦ããããã«ãæãã®ã§ããã¡ããã¾ã æ¹åã®ä½å°ãããããã§ãã
ä»å触ãããmaster replicaåãæ¿ãæ©æ§ãã®è¨è¨ã詳細ã«ã¤ãã¦ã¯ããã£ã¨è©³ããè³æã社å
ã«ãããã¾ãð
ã³ãããã§ã¯ãµã¼ãã¼ãµã¤ãã¨ã³ã¸ãã¢ãåéãã¦ãã¾ãã®ã§ãæ¯éãæ°è»½ã«éã³ã«æ¥ã¦ãã ãããï¼
www.wantedly.com
ã¾ãã11æã«éå¬ãããCakeFestã§ã¯å¼ç¤¾CTOãç»å£ãã¾ãã®ã§ãå¿æ´ãã¦ãã ããï¼ï¼
â¢â¢ MEET @itosho â¢â¢
— CakePHP (@cakephp) September 26, 2019
Sho Ito will be speaking at #CakeFest2019 in Japan. He is the CTO at Connehito inc, and a developer of CakePHPâs OSS. We are glad to have such great contributors! #cakephp #cakefest #cakephpconference #conference #pho #oss #developers pic.twitter.com/qvdI1JCDUC
*1:å®éã«ãããªæ§æã使ããããï¼ã¯å¥ã¨ãã¦ãããã¾ã§ãããããäºãã§ããããã¨ããã®ã説æããããã®å 容ã§ã
*2:æåå³åã§ããã以åã«ãã®è¾ºãã調ã¹ã¦ã¿ãè¨äºãããã¾ãããããããã°å¾¡è¦§ãã ãã https://cake.nichiyoubi.land/posts/10-orm-database/