本文整理匯總了PHP中type::createQuery方法的典型用法代碼示例。如果您正苦於以下問題:PHP type::createQuery方法的具體用法?PHP type::createQuery怎麽用?PHP type::createQuery使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類type
的用法示例。
在下文中一共展示了type::createQuery方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: ultimoEncaminhamentoExterno
/**
*
* @return type
*/
public function ultimoEncaminhamentoExterno($idDoc)
{
try {
$obj = $this->manager->createQuery("SELECT e FROM ProtocoloBundle:Encaminhamentos e " . "JOIN e.documentosDocumento d " . "JOIN e.entradasExterna en " . "WHERE d.idDocumento = ?1 AND en.statusEntrada = false ORDER BY e.idEncaminhamento DESC ")->setParameter("1", $idDoc)->setMaxResults('1');
return $obj->getResult();
} catch (Exception $ex) {
return null;
}
}
示例2: searchDocTramitado
/**
*
* @param type $codigo
* @return type
*/
public function searchDocTramitado($codigo)
{
try {
$obj = $this->manager->createQuery("SELECT e FROM ProtocoloBundle:EntradasExterna e " . "JOIN e.encaminhamentos ec " . "JOIN ec.documentosDocumento d " . "WHERE d.codIndentificadorDocumento = :cod AND e.statusEntrada = false ")->setParameter("cod", $codigo);
return $obj->getResult();
} catch (Exception $ex) {
return null;
}
}
示例3: getSubsecretariaBySecretaria
/**
*
* @param type $idSecretaria
* @return boolean
*/
public function getSubsecretariaBySecretaria($idSecretaria)
{
try {
$query = $this->manager->createQuery("SELECT s FROM ProtocoloBundle:Subsecretaria s " . "JOIN s.secretarias se " . "WHERE se.idSecretaria = :id ")->setParameter("id", $idSecretaria);
return $result = $query->getArrayResult();
} catch (Exception $ex) {
return false;
}
}
示例4: findByProPendentes
/**
*
* @return type
*/
public function findByProPendentes()
{
try {
$obj = $this->manager->createQuery("SELECT e FROM ProtocoloBundle:Entradas e " . "JOIN e.usuarios u " . "WHERE e.statusEnvio = false AND e.statusEntrada = true AND e.statusPendencia = true ");
return $obj->getResult();
} catch (Exception $ex) {
return null;
}
}
示例5: builderQuery
/**
*
*/
public function builderQuery()
{
try {
$dqlWhere = " ";
if (!empty($this->whereValueMain)) {
$dqlWhere .= " WHERE {$this->columnWhereMain} = {$this->whereValueMain}";
} else {
//$dqlWhere .= " WHERE ";
}
if (!empty($this->whereFull)) {
$dqlWhere .= " WHERE {$this->whereFull}";
}
$whereGlobal = false;
$wherePerson = false;
$filterValue = array();
$filterKey = array();
$dqlStart = $this->start;
$dqlLength = $this->length;
$dqlColumn = $this->columns;
$dqlFilter = $this->filter($this->parametros, $dqlColumn);
if (count($dqlFilter) > 0) {
$this->filterBool = true;
}
$dqlOrder = $this->order($this->parametros, $dqlColumn);
$letras = array('b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k');
$entityJoin = $this->entityJOIN;
$sqlJoin = "";
//$entityJoinMain = $this->entityJOINWhereMain;
for ($i = 0; $i < count($entityJoin); $i++) {
$verifyJoin = explode(".", $entityJoin[$i]);
$verifyLeft = explode(":", $entityJoin[$i]);
if (count($verifyLeft) == 2) {
$sqlJoin .= " LEFT JOIN {$verifyLeft[0]} {$letras[$i]} ";
} else {
if (count($verifyJoin) == 2) {
$sqlJoin .= " JOIN {$entityJoin[$i]} {$letras[$i]} ";
} else {
$sqlJoin .= " JOIN a.{$entityJoin[$i]} {$letras[$i]} ";
}
}
}
if (!empty($dqlFilter)) {
if (!empty($this->whereValueMain) || !empty($this->whereFull)) {
$dqlWhere .= " AND (";
} else {
$dqlWhere .= " WHERE (";
}
if (is_array($dqlFilter)) {
$wherePerson = true;
$filterKey = array_keys($dqlFilter);
$filterValue = array_values($dqlFilter);
for ($i = 0; $i < count($filterKey); $i++) {
$index = $i + 1;
$dqlWhere .= " {$filterKey[$i]} LIKE ?{$index} AND ";
}
} else {
$whereGlobal = true;
foreach ($dqlColumn as $valor) {
$dqlWhere .= " {$valor} LIKE ?1 OR ";
}
}
$dqlWhere = substr($dqlWhere, 0, -4) . ")";
}
$query = $this->em->createQuery("SELECT distinct a FROM {$this->entity} a" . " {$sqlJoin} " . " {$dqlWhere} " . "ORDER BY {$dqlOrder}")->setFirstResult($dqlStart)->setMaxResults($dqlLength);
if ($whereGlobal) {
$query->setParameter(1, strtoupper("%{$dqlFilter}%"));
} else {
if ($wherePerson) {
for ($i = 0; $i < count($filterValue); $i++) {
$index = $i + 1;
$query->setParameter($index, strtoupper("%{$filterValue[$i]}%"));
}
}
}
//var_dump($query); exit();
$result = $query->getResult();
//var_dump($result); exit();
return $result;
} catch (Exception $ex) {
print_r($ex);
}
}