My FIU Curriculum Class Reference. Yii Framework

Dgu

Package application
Inheritance class Dgu » VersionedEntity
Source Code
Description of Dgu

Method Details

Dgu() method
public void Dgu($entityId, $catalogId)
$entityId
$catalogId
Source Code: (show)
public function Dgu($entityId$catalogId){
    
$this->his_tableName 'his_dgu';
    
parent::VersionedEntity($entityId$catalogId);
}

createNewHistoryRecord() method
protected void createNewHistoryRecord()
Source Code: (show)
protected function createNewHistoryRecord() {
    
    
    
$hisRecord $this->entity->hisDgus[0];
    
$newHisRecord = new HisDgu();
    
$newHisRecord->setAttributes($hisRecord->attributes);
    
$newHisRecord->unsetAttributes(array('id'));
    
$newHisRecord->setIsNewRecord(true);
    
$newHisRecord->catalog_id $this->catalog_id;
    
    
//        $newRecord->attributes = $this->entity->HisDgu[0]->attributes;
//        //declare new
//        $newRecord->isNewRecord = true;
//        //update version
//        $newRecord->catalog_id = $this->catalog_id;
    
    
return $newHisRecord->save();
    
    
}

entityExistsCurr() method
protected static void entityExistsCurr($model)
$model
Source Code: (show)
protected static function entityExistsCurr($model) {
    return 
CurrDgu::model()->exists('id=:id', array(':id'=>$model->id));
}

entityExistsHis() method
protected static void entityExistsHis($model)
$model
Source Code: (show)
protected static function entityExistsHis($model) {
    return 
HisDgu::model()->exists('id=:id', array(':id'=>$model->id));
}

findEntity() method
protected void findEntity($entityId)
$entityId
Source Code: (show)
protected function findEntity($entityId) {        
    
    
//SELECT * FOROM curr_dgu, his_dgu 
    //  WHERE id = $entityId AND his_dgu.catalog_id=$$versionId
    
$entity CurrDgu::model()->with('hisDgus')->find('t.id=:entityId AND hisDgus.catalog_id=:versionId',
            array(
':entityId'=>$entityId':versionId'=> $this->catalog_id ));
    
    
//if version does not exists, find the most reasent one
    
if(is_null($entity)){
        
        
//get the most resent activity
        
$mostResentActiveVersion $this->getMostResentActivatedVersionForEntity($entityId$this->his_tableName);
        
        
//            SELECT * FOROM curr_dgu, his_dgu 
//              WHERE id = $entityId AND his_dgu.catalog_id=$$versionId
        
$entity CurrDgu::model()->with('hisDgus')->find('t.id=:entityId AND hisDgus.catalog_id=:versionId',
            array(
':entityId'=>$entityId':versionId'=> $mostResentActiveVersion['id']));
        
    }
    
    return 
$entity;
}

getHistoryEntities() method
public void getHistoryEntities()
Source Code: (show)
public function getHistoryEntities() {
    return 
HisDgu::model()->findAll('identifier_id=:entityId', array('entityId'=>$this->entity->id));
    
}

getHistoryEntity() method
public void getHistoryEntity()
Source Code: (show)
public function getHistoryEntity() {
    return 
$this->entity->hisDgus[0];
    
}

newEntity() method
protected static void newEntity($currModel, $hisModel)
$currModel
$hisModel
Source Code: (show)
protected static function newEntity($currModel$hisModel) {
    
    
// create base
    
if($currModel->save()){
        
        
$hisModel->identifier_id $currModel->id;
        
        if(
$hisModel->save()){
            return 
$currModel->id;
        }
        else{
            throw new 
Exception("cannot create hisModel for identifier: ".$currModel->id);
        }
    }
    else{
        throw new 
Exception("cannot create currModel");
    }
    
}

updateHistoryRecord() method
protected void updateHistoryRecord()
Source Code: (show)
protected function updateHistoryRecord() {
    
$hisRecord $this->entity->hisDgus[0];
    return 
$hisRecord->save();
}

Copyright © 2008-2011 by Yii Software LLC
All Rights Reserved.