Jump to content
Larry Ullman's Book Forums

rjma30

Members
  • Content Count

    5
  • Joined

  • Last visited

Community Reputation

0 Neutral

About rjma30

  • Rank
    Newbie
  1. No worries I was able to make it work. Thanks anyway! ======================= $criteria=new CDbCriteria; $criteria->with = 'centers'; $criteria->together = true; $criteria->compare('centers.center_number', $this->device_id, true);
  2. No worries I was able to make it work. Thanks anyway! ======================= $criteria=new CDbCriteria; $criteria->with = 'centers'; $criteria->together = true; $criteria->compare('centers.center_number', $this->device_id, true); $criteria->compare('type',$this->type); $criteria->compare('manufacturer',$this->manufacturer); $criteria->compare('management_ip', ($this->inetAtoN($this->management_ip)) ? $this->inetAtoN($this->management_ip) : '', true); $criteria->order = 'centers.center_number ASC,
  3. So basically I want to display below information in my CGridView: mysql> SELECT c.center_number, d.management_ip, d.type -> FROM device AS d LEFT JOIN center_has_device USING (device_id) -> LEFT JOIN center AS c USING (center_id) ORDER BY c.center_number ASC; +---------------+---------------+------+ | center_number | management_ip | type | +---------------+---------------+------+ | 1 | 2887713278 | 3 | | 2 | 2887713278 | 3 | | 34 | 3232261243 | 5 | | 34 | 2887713278 | 3 | +---------------+---------------
  4. Hi Edward, Here's my config: public function relations() { return array( 'centers' => array(self::MANY_MANY, 'Center', 'center_has_device(device_id, center_id)'), ); public function search() { $criteria=new CDbCriteria; $criteria->with=array('centers'); return new CActiveDataProvider($this, array( 'criteria'=>$criteria, )); } CURRENT DATA: mysql> SELECT * FROM device; +-----------+------+---------------+ | device_id | type | management_ip | +-----------+------+---------------+ | 4 | 5 | 3232261243 | |
  5. Hello, Any recommendation for viewing/displaying data with MANY_MANY relationship? Thanks!
×
×
  • Create New...