CakePHP3ã§ç°¡æç£æ»ãã°
æ å ±ã·ã¹ãã ãçµã¿ä¸ããã¨ãã¯ã誰ããã¤ä½ããããã¨ãã£ãæ å ±ãæ®ãã¦ãããã¨ãé常ã«ããããã¾ãããã®æ å ±ã®ãã¨ãç£æ»ãã°ã¨å¼ã³ã¾ãããä»ã«ãå¼ã³æ¹ãããããããã¾ãããè±èªã§ã¯ audit trail ã¨è¨ã£ãããã¦ãã¨æãã¾ãããã¶ãã
ãã®ã·ã¹ãã ãRDBï¼é¢ä¿ãã¼ã¿ãã¼ã¹ï¼ãç¨ãããã®ã§ããå ´åãç£æ»ãã°ãã®ãã®ãRDBä¸ã«æ®ããã¨ãããã¾ãã
ãã¡ãã¨ããç£æ»ãã°ã«ããããã«ã¯ãç£æ»ãã°ãæ ¼ç´ããããã®å°ç¨ã®ãã¼ãã«ãè¨ãã¾ãããã®ãã¼ãã«ã¯ã·ã¹ãã å
¨ä½ã§1åã§ãããã¨ãããã°ãã·ã¹ãã ã管çãã¦ãããã¼ã¿ãã¨ã«è¨ãã¦ãããã¨ãããã¾ããå°ç¨ã®ãã¼ãã«ãè¨ããã«ããããããè«çåé¤ããç©ã¿éãã¦ãã£ã¦ãããç£æ»ãã°ä»£ããã«ãããã¨ãããã§ãããï¼æã¾ããã¨ã¯æãã¾ãããï¼ã
ãããã®ææ³ã¯ãæ£ç¢ºãªç£æ»ãã°ãåããããã«ãªã代ããã«ãããªãæéããããã¾ããæ§ç¯ããæ
å ±ã·ã¹ãã ã«ãããäºç®ãå°ãªãã£ããæéãçãã£ããããã¨ãçç¥ããããã¨ããã°ãã°ããã¾ãã
çç¥ããã¨ã¯è¨ã£ã¦ãå®å
¨ã«ä½ãè¨é²ãåããªãã®ã¯ç²¾ç¥è¡çä¸ããããã¾ããã®ã§ãç°¡æçãªç£æ»ãã°ãã¨ããã¨ã«ãªãã¾ãã
ä½ãç°¡æãªã®ãã¨è¨ãã¨ãä¿æããæ
å ±ã以ä¸ã®ãã®ã«éãã®ã§ãã
- å½è©²ãã¼ã¿ãæåã«ç»é²ããæ¥æ
- å½è©²ãã¼ã¿ãæåã«ç»é²ãã人
- å½è©²ãã¼ã¿ãæå¾ã«æ´æ°ããæ¥æ
- å½è©²ãã¼ã¿ãæå¾ã«æ´æ°ãã人
ããã ãã®æ å ±ãæ®ã£ã¦ããã°ãæ¬å½ã«å ããªãã®ã§ã¯ããã¾ãããä½ã調æ»ããã¨ãã®æãããã«ã¯ãªãã¾ãã
ãã¦ãããªãé·ãåç½®ãã«ãªãã¾ããããããããã¯CakePHPã®è©±ã§ãã
CakePHPã§ã¯æããï¼å°ãªãã¨ã 2.x ç³»ããï¼ãæ¥æã ãã§ã¯ããã¾ãããç°¡æã®ç£æ»ãã°ãRDBã«ä¿åããä»çµã¿ãããã¾ãããã¼ãã«ã«ãmodifiedããcreatedãã¨ãã£ãã¿ã¤ã ã¹ã¿ã³ãåã®åãç¨æãã¦ããã¨ãããã«èªåã§ç»é²æ¥æãæ´æ°æ¥æãã»ãããã¦ãããã®ã§ãã
Saving Your Data — CakePHP Cookbook 2.x documentation
ç»é²ï¼æ´æ°ãã人ã«ã¤ãã¦ã¯ã AuthComponent::user('id')
ã«ãã£ã¦Modelå
ã®ã³ã¼ãããã§ãå½è©²HTTPãªã¯ã¨ã¹ãã®ã»ãã·ã§ã³ã«ç´ä»ããã¦ã¼ã¶IDãåããã¨ãã§ããã®ã§ãbeforeSave
ã³ã¼ã«ããã¯ããããå®è£
ããã°ä¿åã§ãã¦ãã¾ããã
ã¨ããããCakePHP 3.x ã«ãªã£ã¦ãããä¸è¨ã®æ¹æ³ã§ã¯ã¦ã¼ã¶IDãåå¾ãããã¨ãã§ããªããªã£ã¦ãã¾ãã¾ããããã®ãã¨ã¯GitHubä¸ã§ã話é¡ã«ãªãããããªissueãç«ã¦ããã¦ãã¾ããgithub.com
è¯ãè¨è¨ã§ã¯ãªããã®ãèªçºããã¨ããçç±ã§éæ»ã§closeããã¦ãã¾ã£ã¦ãã¾ããããã¾ã§ã®ææ³ããã®ãããªæ§è³ªã帯ã³ããã®ã§ãããã¨ã«ã¯ä¸åç°è«ã¯ç¡ãã®ã§ãããç°¡æç£æ»ãã°ãåããã¨ã«ãããªã«ã³ã¹ãï¼æéï¼ãããããªãã¨ããã®ãäºå®ã§ãã
ããããæªãè¨è¨ã§ãããã¨ã¯éã
æ¿ç¥ã®ä¸ã§ç°¡åãªå®è£
ãä½ã£ã¡ããï¼ ã¨ãããã¨ã§ãModelã®Behaviorãä½ãã¾ãããã½ã¼ã¹ã¯Gistã«ç½®ãã¦ãã®ããã®è¨äºã«åãè¾¼ãã§ã¾ãã
gist.github.com
ä½ã£ãå¾ã«æ°ä»ããã®ã§ãããç´ æ´ãããå
人ãã¡ã¯ãã£ã¨è¯ãå®è£
ãæ¢ã«ããã¦ãã¾ãããgithub.com
ããã¯Pluginã¨ãã¦ã®å®è£
ãªã®ã§ããã¡ãã®æ¹ã使ãæãã¨ãã人ãå¤ãã§ãããããããstaticããããã¨å¼ã°ããå±éºæ§ãæã¿åã£ã¦ããã¦ãã¾ããã
ãããã£ããã®ãæ´»ç¨ãã¦ãæ°è»½ã«ç°¡æç£æ»ãã°ãåããããã«ãã¦ãå¥å ¨ãªæ å ±ã·ã¹ãã ãæ§ç¯ãã¦ããã¾ãããã