Example #1
0
 public function test_for_table_inheritance()
 {
     $Event = new Event(array('description' => 'Uncategorized Event'));
     $this->assertTrue($Event->save());
     $Concert = new Concert(array('description' => 'Madonna at Barcelona'));
     $this->assertTrue($Concert->save());
     $OpenHouseMeeting = new OpenHouseMeeting(array('description' => 'Networking event at Akelos'));
     $this->assertTrue($OpenHouseMeeting->save());
     $this->assertEqual($OpenHouseMeeting->get('type'), 'Open house meeting');
     $this->assertTrue($OpenHouseMeeting = $Event->findFirstBy('description', 'Networking event at Akelos'));
     $this->assertEqual($OpenHouseMeeting->get('description'), 'Networking event at Akelos');
     $this->assertEqual($OpenHouseMeeting->getType(), 'OpenHouseMeeting');
 }
Example #2
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Concert();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Concert'])) {
         $model->attributes = $_POST['Concert'];
         if ($model->save()) {
             $this->redirect(array('admin'));
         }
     }
     $this->render('create', array('model' => $model));
 }