i have 12 tables i want to do search buy using all 12 tables but on one view page.how i can do it .
i have 12 tables i want to do search buy using all 12 tables but on one view page.how i can do it .
Are those tables related, can U provide table structure and model relations
Blogger Model
<?php
/**
* This is the model class for table "tbl_blogger".
*
* The followings are the available columns in table 'tbl_blogger':
* @property integer $id
* @property integer $contact_id
* @property integer $personal_id
* @property string $blogger_name
* @property string $blog_name
* @property string $email
* @property integer $rating
* @property string $city
* @property string $state
* @property string $country
* @property string $status
* @property string $contract_status
* @property string $blog_url
* @property string $about_me
* @property string $image
*
* The followings are the available model relations:
* @property Contact $contact
* @property Personalinfo $personal
* @property BloggerexpertiseRelation[] $bloggerexpertiseRelations
* @property BloggerinterestRelation[] $bloggerinterestRelations
* @property BloggernoteRelation[] $bloggernoteRelations
* @property BloggerprojectRelation[] $bloggerprojectRelations
* @property BloggersocialRelation[] $bloggersocialRelations
* @property BloggersurveyRelation[] $bloggersurveyRelations
* @property Socialmedia[] $socialmedias
*/
class Blogger extends CActiveRecord
{
/**
* @return string the associated database table name
*/
public function tableName()
{
return 'tbl_blogger';
}
/**
* @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('contact_id, personal_id, blogger_name, email, status, contract_status', 'required'),
array('contact_id, personal_id, rating', 'numerical', 'integerOnly'=>true),
array('blogger_name, email, blog_url', 'length', 'max'=>50),
array('blog_name', 'length', 'max'=>100),
array('city, state, country', 'length', 'max'=>20),
array('status', 'length', 'max'=>12),
array('contract_status', 'length', 'max'=>16),
array('about_me', 'length', 'max'=>300),
array('image', 'file', 'types'=>'jpg, gif, png, bmp, jpeg','maxSize'=>1024 * 1024 * 10, // 10MB
'tooLarge'=>'The file was larger than 10MB. Please upload a smaller file.','allowEmpty' => true),
// The following rule is used by search().
// @todo Please remove those attributes that should not be searched.
array('id, contact_id, personal_id, blogger_name, blog_name, email, rating, city, state, country, status, contract_status, blog_url, about_me, image', 'safe', 'on'=>'search'),
);
}
/**
* @return array relational rules.
*/
public function relations()
{
// NOTE: you may need to adjust the relation name and the related
// class name for the relations automatically generated below.
return array(
'contact' => array(self::BELONGS_TO, 'Contact', 'contact_id'),
'personal' => array(self::BELONGS_TO, 'Personalinfo', 'personal_id'),
'bloggerexpertiseRelations' => array(self::HAS_MANY, 'BloggerexpertiseRelation', 'blogger_id'),
'bloggerinterestRelations' => array(self::HAS_MANY, 'BloggerinterestRelation', 'blogger_id'),
'bloggernoteRelations' => array(self::HAS_MANY, 'BloggernoteRelation', 'blogger_id'),
'bloggerprojectRelations' => array(self::HAS_MANY, 'BloggerprojectRelation', 'blogger_id'),
'bloggersocialRelations' => array(self::HAS_MANY, 'BloggersocialRelation', 'blogger_id'),
'bloggersurveyRelations' => array(self::HAS_MANY, 'BloggersurveyRelation', 'blogger_id'),
'socialmedias' => array(self::HAS_MANY, 'Socialmedia', 'blogger_id'),
);
}
/**
* @return array customized attribute labels (name=>label)
*/
public function attributeLabels()
{
return array(
'id' => 'ID',
'contact_id' => 'Contact',
'personal_id' => 'Personal',
'blogger_name' => 'Blogger Name',
'blog_name' => 'Blog Name',
'email' => 'Email',
'rating' => 'Rating',
'city' => 'City',
'state' => 'State',
'country' => 'Country',
'status' => 'Status',
'contract_status' => 'Contract Status',
'blog_url' => 'Blog Url',
'about_me' => 'About Me',
'image' => 'Image',
);
}
/**
* 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',$this->id);
$criteria->compare('contact_id',$this->contact_id);
$criteria->compare('personal_id',$this->personal_id);
$criteria->compare('blogger_name',$this->blogger_name,true);
$criteria->compare('blog_name',$this->blog_name,true);
$criteria->compare('email',$this->email,true);
$criteria->compare('rating',$this->rating,true);
$criteria->compare('city',$this->city,true);
$criteria->compare('state',$this->state,true);
$criteria->compare('country',$this->country,true);
$criteria->compare('status',$this->status,true);
$criteria->compare('contract_status',$this->contract_status,true);
$criteria->compare('blog_url',$this->blog_url,true);
$criteria->compare('about_me',$this->about_me,true);
$criteria->compare('image',$this->image,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 Blogger the static model class
*/
public static function model($className=__CLASS__)
{
return parent::model($className);
}
}
yes other tables arre related