Ejemplo n.º 1
0
 public function getCondition($alias = null)
 {
     $alias = $alias !== null ? $alias . '.' : '';
     $condition = new Condition();
     $condition->greaterThen($alias . 'date', $this->from->format('Y-m-d 00:00:00'));
     $condition->lowerThen($alias . 'date', $this->to->format('Y-m-d 23:59:59'));
     if (!empty($this->appId)) {
         $condition->equals($alias . 'appId', $this->appId);
     }
     if (!empty($this->routeId)) {
         $condition->equals($alias . 'routeId', $this->routeId);
     }
     if (!empty($this->ip)) {
         $condition->like($alias . 'ip', $this->ip);
     }
     if (!empty($this->userAgent)) {
         $condition->like($alias . 'userAgent', '%' . $this->userAgent . '%');
     }
     if (!empty($this->method)) {
         $condition->equals($alias . 'method', $this->method);
     }
     if (!empty($this->path)) {
         $condition->like($alias . 'path', $this->path . '%');
     }
     if (!empty($this->header)) {
         $condition->like($alias . 'header', '%' . $this->header . '%');
     }
     if (!empty($this->body)) {
         $condition->like($alias . 'body', '%' . $this->body . '%');
     }
     return $condition;
 }