public function searchConfiguration() { $search = new Manager($this); $search->like('q', ['before' => true, 'after' => true, 'field' => [$this->aliasField('titulo'), $this->aliasField('descripcion')]])->compare('fecha_de', ['field' => $this->aliasField('fecha_ini'), 'filterEmpty' => true])->compare('fecha_a', ['operator' => '<=', 'field' => $this->aliasField('fecha_ini'), 'filterEmpty' => true])->value('trimestre', ['field' => $this->aliasField('trimestre'), 'filterEmpty' => true])->value('departamentos', ['field' => $this->aliasField('departamento_id'), 'filterEmpty' => true])->callback('cursos', ['callback' => function (Query $query, array $args) { return $query->distinct($this->aliasField('id'))->matching('Curso', function (Query $query) use($args) { return $query->where([$this->Curso->target()->aliasField('id') . ' IN' => $args['cursos']]); }); }]); return $search; }
private function searchConfigurationDynamic() { $search = new Manager($this); $c = $this->schema()->columns(); foreach ($c as $key => $value) { $t = $this->schema()->columnType($value); if ($t != 'string' and $t != 'text') { $search->value($value, ['field' => $this->aliasField($value)]); } else { $search->like($value, ['before' => true, 'after' => true, 'field' => $this->aliasField($value)]); } } return $search; }
private function searchConfigurationDynamic() { $search = new Manager($this); $c = $this->schema()->columns(); foreach ($c as $key => $value) { $t = $this->schema()->columnType($value); if ($t != 'string' and $t != 'text') { $search->value($value, ['field' => $this->aliasField($value)]); } else { $search->like($value, ['before' => true, 'after' => true, 'field' => $this->aliasField($value)]); } } $search->callback('associacao', ['callback' => function ($query, $args, $manager) { return $query->join(['table' => 'pessoas_associacoes', 'alias' => 'PessoasAssociacoesPesquisa', 'type' => 'INNER', 'conditions' => ['PessoasAssociacoesPesquisa.pessoa_id = Pessoas.id', 'PessoasAssociacoesPesquisa.tipo_associacao' => $args['associacao'], 'PessoasAssociacoesPesquisa.status !=' => 9]]); }]); return $search; }
private function searchConfigurationDynamic() { $search = new Manager($this); $c = $this->schema()->columns(); foreach ($c as $key => $value) { $t = $this->schema()->columnType($value); if ($t != 'string' and $t != 'text') { $search->value($value, ['field' => $this->aliasField($value)]); } else { $search->like($value, ['before' => true, 'after' => true, 'field' => $this->aliasField($value)]); } } $search->callback('barra', ['callback' => function ($query, $args, $manager) { return $query->join(['table' => 'produtos', 'alias' => 'kprodutosbarra', 'type' => 'INNER', 'conditions' => 'kprodutosbarra.id = ProdutosKits.kit_id AND kprodutosbarra.barra RLIKE "' . $args['barra'] . '" AND kprodutosbarra.produto_kit = 1']); }]); $search->callback('nome', ['callback' => function ($query, $args, $manager) { return $query->join(['table' => 'produtos', 'alias' => 'kprodutosnome', 'type' => 'INNER', 'conditions' => 'kprodutosnome.id = ProdutosKits.kit_id AND kprodutosnome.nome RLIKE "' . $args['nome'] . '" AND kprodutosnome.produto_kit = 1']); }]); return $search; }
/** * searchConfiguration */ public function searchConfiguration() { $search = new Manager($this); $search->like('image', ['before' => true, 'after' => true, 'field' => [$this->alias() . '.image']]); return $search; }
/** * searchConfiguration */ public function searchConfiguration() { $search = new Manager($this); $search->like('title', ['before' => true, 'after' => true, 'field' => [$this->alias() . '.title']])->value('publish', ['field' => $this->alias() . '.publish'])->value('category', ['field' => $this->alias() . '.category_id'])->value('user', ['field' => $this->alias() . '.user_id'])->like('search', ['before' => true, 'after' => true, 'field' => ['title', 'content']]); return $search; }
/** * Allows to search users by partial username * @return \Search\Manager */ public function searchConfiguration() { $search = new Manager($this); $search->like('username', ['before' => true, 'after' => true, 'field' => [$this->aliasField('username')]]); return $search; }