BasicRelationsHasOne.php
Current file: /home/magister/git/yii-example/example/protected/models/BasicRelationsHasOne.php
Legend: executed not executed dead code

  Coverage
  Classes Functions / Methods Lines
Total
0.00% 0 / 1
83.33% 5 / 6 CRAP
63.16% 12 / 19
BasicRelationsHasOne
0.00% 0 / 1
83.33% 5 / 6 7.80
63.16% 12 / 19
 model($className=__CLASS__)
100.00% 1 / 1 1
100.00% 1 / 1
 tableName()
100.00% 1 / 1 1
100.00% 1 / 1
 rules()
100.00% 1 / 1 1
100.00% 4 / 4
 relations()
100.00% 1 / 1 1
100.00% 2 / 2
 attributeLabels()
100.00% 1 / 1 1
100.00% 4 / 4
 search()
0.00% 0 / 1 2
0.00% 0 / 7


       1                 : <?php                                                                                                                 
       2                 :                                                                                                                       
       3                 : /**                                                                                                                   
       4                 :  * This is the model class for table "tbl_basic_relations_has_one".                                                   
       5                 :  *                                                                                                                    
       6                 :  * The followings are the available columns in table 'tbl_basic_relations_has_one':                                   
       7                 :  * @property integer $id                                                                                              
       8                 :  * @property integer $column_main_id                                                                                  
       9                 :  * @property string $column_has_one_content                                                                           
      10                 :  */                                                                                                                   
      11                 : class BasicRelationsHasOne extends BasicRelationsModel {                                                              
      12                 :     /**                                                                                                               
      13                 :      * Returns the static model of the specified AR class.                                                            
      14                 :      * @return BasicRelationsHasOne the static model class                                                            
      15                 :      */                                                                                                               
      16                 :     public static function model($className=__CLASS__) {                                                              
      17               2 :         return parent::model($className);                                                                             
      18                 :     }                                                                                                                 
      19                 :                                                                                                                       
      20                 :     /**                                                                                                               
      21                 :      * @return string the associated database table name                                                              
      22                 :      */                                                                                                               
      23                 :     public function tableName() {                                                                                     
      24              10 :         return 'tbl_basic_relations_has_one';                                                                         
      25                 :     }                                                                                                                 
      26                 :                                                                                                                       
      27                 :     /**                                                                                                               
      28                 :      * @return array validation rules for model attributes.                                                           
      29                 :      */                                                                                                               
      30                 :     public function rules() {                                                                                         
      31                 :         return array(                                                                                                 
      32                 : //            array ('column_main_id, column_has_one_content', 'required'),                                           
      33                 : //            array ('column_main_id', 'numerical', 'integerOnly' => true),                                           
      34               3 :             array ('column_main_id', 'unsafe', 'on' => 'insert, update'),                                             
      35               3 :             array ('column_has_one_content', 'length', 'max' => 255),                                                 
      36               3 :             array ('id, column_main_id, column_has_one_content', 'safe', 'on' => 'search'),                           
      37               3 :         );                                                                                                            
      38                 :     }                                                                                                                 
      39                 :                                                                                                                       
      40                 :     /**                                                                                                               
      41                 :      * @return array relational rules.                                                                                
      42                 :      */                                                                                                               
      43                 :     public function relations() {                                                                                     
      44                 :         return array(                                                                                                 
      45               1 :             'relation_belongs_to_main' => array (self::BELONGS_TO, 'BasicRelationsMain', 'column_main_id'),           
      46               1 :         );                                                                                                            
      47                 :     }                                                                                                                 
      48                 :                                                                                                                       
      49                 :     /**                                                                                                               
      50                 :      * @return array customized attribute labels (name=>label)                                                        
      51                 :      */                                                                                                               
      52                 :     public function attributeLabels() {                                                                               
      53                 :         return array(                                                                                                 
      54               1 :             'id' => 'ID',                                                                                             
      55               1 :             'column_main_id' => 'Column Main ID',                                                                     
      56               1 :             'column_has_one_content' => 'Column Has One Content',                                                     
      57               1 :         );                                                                                                            
      58                 :     }                                                                                                                 
      59                 :                                                                                                                       
      60                 :     /**                                                                                                               
      61                 :      * Retrieves a list of models based on the current search/filter conditions.                                      
      62                 :      * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
      63                 :      */                                                                                                               
      64                 :     public function search() {                                                                                        
      65               0 :         $criteria=new CDbCriteria;                                                                                    
      66               0 :         $criteria->compare('id',$this->id);                                                                           
      67               0 :         $criteria->compare('column_main_id',$this->column_main_id);                                                   
      68               0 :         $criteria->compare('column_has_one_content',$this->column_has_one_content,true);                              
      69               0 :         return new CActiveDataProvider('BasicRelationsHasOne', array(                                                 
      70               0 :             'criteria'=>$criteria,                                                                                    
      71               0 :         ));                                                                                                           
      72                 :     }                                                                                                                 
      73                 : }                                                                                                                     

Generated by PHP_CodeCoverage 1.1.2 using PHP 5.4.4-14+deb7u2 and PHPUnit 3.6.10 at Tue Aug 13 16:58:12 CDT 2013.