Object::getRelatedContentByTags PHP Method

getRelatedContentByTags() public static method

get Related content by Tags
public static getRelatedContentByTags ( type $id, type $max ) : CActiveDataProvider
$id type
$max type
return CActiveDataProvider
    public static function getRelatedContentByTags($id, $max)
    {
        $object = Object::loadModel($id);
        $criteria = new CDbCriteria();
        $criteria->join = 'join gxc_tag_relationships ft on ft.object_id = t.object_id';
        $criteria->condition = 'ft.tag_id in (select tag_id from fcms_tag_relationships fr
                                                where fr.object_id = :id)
                                    AND t.object_id <> :id  
                                    AND t.object_status = :status
                                    AND t.object_date <= :time
                                    AND t.object_type = :type';
        $criteria->distinct = true;
        $criteria->params = array(':id' => $id, ':status' => ConstantDefine::OBJECT_STATUS_PUBLISHED, ':time' => time(), 'type' => $object->object_type);
        $criteria->order = "object_date DESC";
        //$aa = Object::model()->findAll($criteria);
        //$criteria->limit = $max;
        return new CActiveDataProvider('Object', array('criteria' => $criteria, 'pagination' => array('pageSize' => $max)));
    }