public function getDefaultNoteSubscription() { $lastDefaultNote = $this->getFullRecords(); if (count($lastDefaultNote) <= 0) { $DefaultNote = new LbDefaultNote(); $DefaultNote->save(); $lastDefaultNote = $this->getFullRecords(); } $DefaultNoteID = $lastDefaultNote[0]->lb_record_primary_key; $dataProvider = LbDefaultNote::model()->findByPk($DefaultNoteID); return $dataProvider; }
public function actionCreateDefaultNote() { $model = new LbDefaultNote(); $lastDefaultNote = LbDefaultNote::model()->getFullRecords(); if (count($lastDefaultNote) > 0) { return false; } else { if ($model->save()) { return LBApplication::renderPlain($this, array('content' => CJSON::encode($model))); } } }