Model::deconstruct
http://api.cakephp.org/class_model.html#0198f3999e2942f8e82db80fc9e19c30
1.2では、Controller::cleanUpFields()は、非推奨。
<?php class HogeController extends AppController { var $name = 'Hoge'; var $helpers = array( 'Html', 'Form' ); function index() { if ( !empty( $this->data ) ) { pr( $this->data ); pr( $this-> Hoge->deconstruct( 'birthday', $this->data['Hoge']['birthday'] ) ); } } }
<?php class Hoge extends AppModel { var $name = 'Hoge'; var $useTable = false; var $_schema = array( 'birthday' => array( 'type' => 'date' ), ); }
- app/views/hoge/index.cpt
<?php echo $form->create( 'Hoge', array( 'action' => 'index' ) ); $years = range( date( 'Y' ), date( 'Y' ) + 1 ); $form->options['year'] = array_combine( $years, $years ); $form->options['month'] = array_combine( range( 1, 12 ), range( 1, 12 ) ); echo $form->dateTime( 'birthday', 'YMD', 'NONE', null, null, false ); echo $form->end( 'submit' ); ?>