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

  Coverage
  Classes Functions / Methods Lines
Total
0.00% 0 / 1
66.67% 4 / 6 CRAP
42.11% 8 / 19
BasicRelationsHasMany
0.00% 0 / 1
66.67% 4 / 6 12.99
42.11% 8 / 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()
0.00% 0 / 1 2
0.00% 0 / 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_many".                                                  
       5                 :  *                                                                                                                    
       6                 :  * The followings are the available columns in table 'tbl_basic_relations_has_many':                                  
       7                 :  * @property integer $id                                                                                              
       8                 :  * @property integer $column_main_id                                                                                  
       9                 :  * @property string $column_has_many_content                                                                          
      10                 :  */                                                                                                                   
      11                 : class BasicRelationsHasMany extends RelationsActiveRecord {                                                           
      12                 :     /**                                                                                                               
      13                 :      * Returns the static model of the specified AR class.                                                            
      14                 :      * @return BasicRelationsHasMany 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               8 :         return 'tbl_basic_relations_has_many';                                                                        
      25                 :     }                                                                                                                 
      26                 :                                                                                                                       
      27                 :     /**                                                                                                               
      28                 :      * @return array validation rules for model attributes.                                                           
      29                 :      */                                                                                                               
      30                 :     public function rules() {                                                                                         
      31                 :         return array(                                                                                                 
      32               2 :             array ('column_main_id', 'numerical', 'integerOnly' => true),                                             
      33               2 :             array ('column_has_many_content', 'length', 'max' => 255),                                                
      34               2 :             array ('id, column_main_id, column_has_many_content', 'safe', 'on' => 'search'),                          
      35               2 :         );                                                                                                            
      36                 :     }                                                                                                                 
      37                 :                                                                                                                       
      38                 :     /**                                                                                                               
      39                 :      * @return array relational rules.                                                                                
      40                 :      */                                                                                                               
      41                 :     public function relations() {                                                                                     
      42                 :         return array(                                                                                                 
      43               1 :             'relation_belongs_to_main' => array (self::BELONGS_TO, 'BasicRelationsMain', 'column_main_id'),           
      44               1 :         );                                                                                                            
      45                 :     }                                                                                                                 
      46                 :                                                                                                                       
      47                 :     /**                                                                                                               
      48                 :      * @return array customized attribute labels (name=>label)                                                        
      49                 :      */                                                                                                               
      50                 :     public function attributeLabels() {                                                                               
      51                 :         return array(                                                                                                 
      52               0 :             'id' => 'ID',                                                                                             
      53               0 :             'column_main_id' => 'Column Main ID',                                                                     
      54               0 :             'column_has_many_content' => 'Column Has Many Content',                                                   
      55               0 :         );                                                                                                            
      56                 :     }                                                                                                                 
      57                 :                                                                                                                       
      58                 :     /**                                                                                                               
      59                 :      * Retrieves a list of models based on the current search/filter conditions.                                      
      60                 :      * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
      61                 :      */                                                                                                               
      62                 :     public function search() {                                                                                        
      63               0 :         $criteria=new CDbCriteria;                                                                                    
      64               0 :         $criteria->compare('id',$this->id);                                                                           
      65               0 :         $criteria->compare('column_main_id',$this->column_main_id);                                                   
      66               0 :         $criteria->compare('column_has_many_content',$this->column_has_many_content,true);                            
      67               0 :         return new CActiveDataProvider('BasicRelationsHasMany', array(                                                
      68               0 :             'criteria'=>$criteria,                                                                                    
      69               0 :         ));                                                                                                           
      70                 :     }                                                                                                                 
      71                 : }                                                                                                                     

Generated by PHP_CodeCoverage 1.1.2 using PHP 5.4.4-14+deb7u2 and PHPUnit 3.6.10 at Wed Aug 14 22:01:23 CDT 2013.