æ¨æ¥éå¬ãããPHPåå¼·ä¼ï¼ æ±äº¬ã§ä½¿ã£ãè³æã§ãã
http://kunit.jp/docs/PHPTokyo7.pdf
ãã®PDFã§èª¬æãã¦ããããã«ãç¾å¨Wikiã§å
¬éãã¦ããActiveGateway alpha1ã§ã¯ãfind_allãã¨ããããã«RoRã®ActiveRecordåæ§ã¡ã½ããåãã_ãã¤ãªãã«ãªã£ã¦ããã®ãã次ã®ãªãªã¼ã¹ãããfindAllãã¨ããããã«camelCaseã«ãã¾ãã
次ã®ãªãªã¼ã¹ã§ã¯ä»¥ä¸ã®ãã®ã«å¯¾å¿ãããã¨æã£ã¦ãã¾ããï¼ActiveRecordã®æ©è½ãéæããããï¼Î±ã¨ããæãã§ãï¼
- tableInfoã§åå¾ãã¦ãããã£ã¼ã«ãæ
å ±ããã£ãã·ã¥ã§ããããã«ãã
- ã¯ã¨ãªã®çµæããã£ãã·ã¥ã§ããããã«ãã
- SQLæããã³ãã¬ã¼ã¹ãã©ã«ãã«å¯¾ããå¤ããã°ã«è½ã¨ãããã«ããï¼ãããã°ã容æã«ããããããã¡ããã¬ãã«ãããã¦åºãéã調æ´ã§ããããã«ãã¾ãï¼
- destroyãdeleteãå®è¡ããã¨ãã«ãdependent => trueãã¨å®ç¾©ããã¦ããé¢é£ãã¼ãã«ããã£ãå ´åãé£éãã¦åé¤ããããã«ãã
- create_at/create_on/update_at/update_onã¨ãããã£ã¼ã«ããæºåãã¦ãããããèªåçã«æ°è¦ä½ææéãæ´æ°æéãã¯ããããã«ãã
- eachã¡ã½ããã§ã®åå¾ã§å
¨ä»¶ã¾ã¨ãã¦åå¾ã ãã§ã¯ãªãã¦ãæå®ãã件æ°ã ãå
èªã¿ãã¦ãããããªãã¨ãå¯è½ã¨ãã
- ãã¼ã¿ä¿æç¨ã®ã¯ã©ã¹ãå¥éæºåããã°stdClassã®ä»£ããã«ä½¿ããããã«ãããï¼ããã«ãã¸ãã¯ãæ¸ããã¨ãã§ããããã«ãªããããããã¨ActiveRecordãã¿ã¼ã³ã«ãªãï¼
- update/deleteã¡ã½ããã®åå¾ã«ããã¯ãã¤ã³ããæºåãã
- delete_at/delete_onã¨ãããã£ã¼ã«ããããå ´åãdeleteã¡ã½ãããçºè¡ãã¦ãè«çåé¤ããããªãããã«ããï¼ã¤ã¾ãåé¤æ¥æãç»é²ããã ãï¼ãè«çåé¤ãæãç«ã¤ããã«ãdelete_at/delete_onãããå ´åã¯findç³»ã¡ã½ããããdelete_at is nullãã¨ãããããªæ¡ä»¶ãèªåçã«ã¤ããããã«ããã
- ãã¼ãã«ã®é¢é£ä»ãã§ãinner_join => trueãã¨ãã¦ããã°ãINNER JOINãããã®ãçºè¡ããããã«ããï¼alpha1ã¯å¥ã
ã«SQLæãçºè¡ãããï¼
ä»ã«ãããããã®ãããã¨ãªã¼ã¨ããã®ãããã°ããã³ããããããé¡ããã¾ãã