Пример #1
0
 /**
  * Construct with parameter.
  *
  * @param \CActiveRecord|\EMongoDocument $model
  * @param bool $asIs if set this flag then relations array will return without filtering
  * @return array of relations parameters.
  */
 public function getWithParameters($model, $asIs = false)
 {
     if (isset($_GET[self::WITH])) {
         $temp = explode(",", \Yii::app()->request->getParam(self::WITH));
         if ($asIs) {
             return $temp;
         }
         foreach ($temp as $key => $value) {
             if (!isset($model->relations()[$value])) {
                 unset($temp[$key]);
             }
         }
         $temp = Filter::filterWithParameters($temp, get_class($model));
         return $temp;
     } else {
         return array();
     }
 }