Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * This is the model class for table "prod_category".
- *
- * The followings are the available columns in table 'prod_category':
- * @property string $id_cat
- * @property string $cat_par
- * @property string $cat_prior
- * @property string $cat_name
- * @property string $cat_alias
- * @property string $cat_end
- * @property string $cat_visible
- * @property string $cat_img
- * @property string $cat_img_thumb
- * @property string $cat_deleted
- * @property integer $cat_create_date
- * @property integer $cat_modify_date
- * @property string $cat_title
- * @property string $cat_description
- * @property string $cat_keywords
- * @property integer $id_atree
- * @property string $cat_img_pda
- * @property integer $id_photo_type
- * @property string $rdfa_name
- * @property string $link_to_brand
- * @property string $cat_name_ru
- * @property string $cat_meta_description
- */
- class ProdCategory extends CActiveRecord
- {
- public $prod_name;
- public $id_prod;
- public $prod_alias;
- public $prod_img;
- public $prod_img_thumb;
- public function getProdlink(){
- return $this->prod_alias.'_'.$this->id_prod;
- }
- public function tableName()
- {
- return 'prod_category';
- }
- /**
- * @return array validation rules for model attributes.
- */
- public function rules()
- {
- // NOTE: you should only define rules for those attributes that
- // will receive user inputs.
- return array(
- array('cat_alias, cat_create_date, cat_modify_date, cat_title, cat_description, cat_keywords, cat_img_pda, rdfa_name, link_to_brand, cat_name_ru, cat_meta_description', 'required'),
- array('cat_create_date, cat_modify_date, id_atree, id_photo_type', 'numerical', 'integerOnly'=>true),
- array('cat_par, cat_prior', 'length', 'max'=>10),
- array('cat_name, cat_img, cat_img_thumb, cat_title, cat_img_pda, rdfa_name, link_to_brand', 'length', 'max'=>255),
- array('cat_alias', 'length', 'max'=>100),
- array('cat_end, cat_visible, cat_deleted', 'length', 'max'=>3),
- array('cat_name_ru', 'length', 'max'=>455),
- // The following rule is used by search().
- // @todo Please remove those attributes that should not be searched.
- array('id_cat, cat_par, cat_prior, cat_name, cat_alias, cat_end, cat_visible, cat_img, cat_img_thumb, cat_deleted, cat_create_date, cat_modify_date, cat_title, cat_description, cat_keywords, id_atree, cat_img_pda, id_photo_type, rdfa_name, link_to_brand, cat_name_ru, cat_meta_description', 'safe', 'on'=>'search'),
- );
- }
- /**
- * @return array relational rules.
- */
- public function relations()
- {
- return array(
- 'Production' => array(self::MANY_MANY, 'Production', 'prod_join_cat(id_prod, id_prod)'),
- );
- }
- /**
- * @return array customized attribute labels (name=>label)
- */
- public function attributeLabels()
- {
- return array(
- 'id_cat' => 'Id Cat',
- 'cat_par' => 'Cat Par',
- 'cat_prior' => 'Cat Prior',
- 'cat_name' => 'Cat Name',
- 'cat_alias' => 'Cat Alias',
- 'cat_end' => 'Cat End',
- 'cat_visible' => 'Cat Visible',
- 'cat_img' => 'Cat Img',
- 'cat_img_thumb' => 'Cat Img Thumb',
- 'cat_deleted' => 'Cat Deleted',
- 'cat_create_date' => 'Cat Create Date',
- 'cat_modify_date' => 'Cat Modify Date',
- 'cat_title' => 'Cat Title',
- 'cat_description' => 'Cat Description',
- 'cat_keywords' => 'Cat Keywords',
- 'id_atree' => 'Id Atree',
- 'cat_img_pda' => 'Cat Img Pda',
- 'id_photo_type' => 'Id Photo Type',
- 'rdfa_name' => 'Rdfa Name',
- 'link_to_brand' => 'Link To Brand',
- 'cat_name_ru' => 'Cat Name Ru',
- 'cat_meta_description' => 'Cat Meta Description',
- );
- }
- /**
- * Retrieves a list of models based on the current search/filter conditions.
- *
- * Typical usecase:
- * - Initialize the model fields with values from filter form.
- * - Execute this method to get CActiveDataProvider instance which will filter
- * models according to data in model fields.
- * - Pass data provider to CGridView, CListView or any similar widget.
- *
- * @return CActiveDataProvider the data provider that can return the models
- * based on the search/filter conditions.
- */
- public function search()
- {
- // @todo Please modify the following code to remove attributes that should not be searched.
- $criteria=new CDbCriteria;
- $criteria->compare('id_cat',$this->id_cat,true);
- $criteria->compare('cat_par',$this->cat_par,true);
- $criteria->compare('cat_prior',$this->cat_prior,true);
- $criteria->compare('cat_name',$this->cat_name,true);
- $criteria->compare('cat_alias',$this->cat_alias,true);
- $criteria->compare('cat_end',$this->cat_end,true);
- $criteria->compare('cat_visible',$this->cat_visible,true);
- $criteria->compare('cat_img',$this->cat_img,true);
- $criteria->compare('cat_img_thumb',$this->cat_img_thumb,true);
- $criteria->compare('cat_deleted',$this->cat_deleted,true);
- $criteria->compare('cat_create_date',$this->cat_create_date);
- $criteria->compare('cat_modify_date',$this->cat_modify_date);
- $criteria->compare('cat_title',$this->cat_title,true);
- $criteria->compare('cat_description',$this->cat_description,true);
- $criteria->compare('cat_keywords',$this->cat_keywords,true);
- $criteria->compare('id_atree',$this->id_atree);
- $criteria->compare('cat_img_pda',$this->cat_img_pda,true);
- $criteria->compare('id_photo_type',$this->id_photo_type);
- $criteria->compare('rdfa_name',$this->rdfa_name,true);
- $criteria->compare('link_to_brand',$this->link_to_brand,true);
- $criteria->compare('cat_name_ru',$this->cat_name_ru,true);
- $criteria->compare('cat_meta_description',$this->cat_meta_description,true);
- return new CActiveDataProvider($this, array(
- 'criteria'=>$criteria,
- ));
- }
- /**
- * Returns the static model of the specified AR class.
- * Please note that you should have this exact method in all your CActiveRecord descendants!
- * @param string $className active record class name.
- * @return ProdCategory the static model class
- */
- public static function model($className=__CLASS__)
- {
- return parent::model($className);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement