02.08
php
saved
tmazur
Note
tmazur did not leave a note
tmazur did not leave a note
- **MODEL**
- <?php
- class PostComment extends AppModel {
- 'required' => true,
- 'rule'=>'notEmpty',
- 'allowEmpty' => false
- )
- );
- var $name = 'PostComment';
- var $belongsTo = 'Post';
- }
- ?>
- **CONTROLLER**
- <?php
- class PostCommentsController extends AppController {
- var $name = 'PostComments';
- var $scaffold = 'admin';
- function add(){
- Configure::write ( 'debug', 1 );
- $this->autoRender=true;
- $this->layout='empty';
- $this->PostComment->set( $this->data );
- debug($this->PostComment->validates());
- $error=$this->PostComment->save($this->data);
- debug($error);
- $x = $this->PostComment->read();
- $this->set('data',$x['PostComment']);
- }
- }
- }
- ?>
Parsed in 0.058 seconds, using GeSHi 1.0.7.14