More Related Content
Similar to CakePHP Kansai 2008-12-12
Similar to CakePHP Kansai 2008-12-12 (20)
More from Yasuo Harada (7)
CakePHP Kansai 2008-12-12
- 11. ブログ 忍び歩く男 - SLYWALKER http://d.hatena.ne.jp/slywalker/
- 15. 基本的な設定 <?php class Sample extends AppModel { public $name = 'Sample'; public $useTable = false; ↑ テーブルは使わないないよ〜 でも、これだけでは Validation や FormHelper を 使いこなせない !!
- 16. そこで、 $_schema の登場 00045 class Model extends Overloadable { 00095 /** 00096 * Table metadata 00097 * 00098 * @var array 00099 * @access protected 00100 */ 00101 var $_schema = null; http://api.cakephp.org/ より
- 17. 例えば、こんな Table なら CREATE TABLE `users` ( `id` int(11) NOT NULL auto_increment, `name` varchar(255) NOT NULL, `password` varchar(255) NOT NULL, `active` tinyint(1) NOT NULL, `creaeted` datetime NOT NULL, PRIMARY KEY (`id`) )
- 18. $_schema はこんな配列になる var_dump($this->User->_schema); array 'id' => array 'type' => string 'integer' (length=7) 'null' => boolean false 'default' => null 'length' => int 11 'key' => string 'primary' (length=7) 'name' => array 'type' => string 'string' (length=6) 'null' => boolean false 'default' => null 'length' => int 255 'password' => array 'type' => string 'string' (length=6) 'null' => boolean false 'default' => null 'length' => int 255 'active' => array 'type' => string 'boolean' (length=7) 'null' => boolean false 'default' => null 'length' => int 1 'creaeted' => array 'type' => string 'datetime' (length=8) 'null' => boolean false 'default' => null 'length' => null
- 28. ハマリポイント!! function edit($id = null) { ・・・ if ($this->data) { // validates の前に set で Model にデータを渡しておく $this->FormMailView-> set ($this->data); if ($this->FormMailView-> validates ()) { if ($this->_send( $formMailForm['FormMailForm']['email'], $formMailForm['FormMailForm']['title'] )) { $this->Session->setFlash(' 送信しました '); $this->render('send'); return; } else { ・・・
- 36. 機能ごとに整理できる! app/ plugins/ ad/ controllers/ ad_as_controller.php ad_bs_controller.php ad_cs_controller.php models/ ad_a.php ad_b.php ad_c.php views/ ad_as/ ad_bs/ ad_cs/ eh/ …