0
I have the tables:
Operário(id,identidade(string));
Intervenção (data(date), hora(time), duracao(integer));
Avaria (data(date), descricao(string), impedimento(boolean));
Prevista (contagem(integer), duracao(integer), fazer(string), tempo(integer), ficha(string));
And I got the Repository done.
class IntervencaoRepository extends EntityRepository {
public function getRecentIntervencao($number = 30) {
$dql = "SELECT b, e, r FROM Bug b JOIN b.engineer e JOIN b.reporter r ORDER BY b.created DESC";
$query = $this->getEntityManager()->createQuery($dql);
$query->setMaxResults($number);
return $query->getResult();
}
public function getRecentIntervencaoArray($number = 30) {
$dql = "SELECT b, e, r, p FROM Bug b JOIN b.engineer e ".
"JOIN b.reporter r JOIN b.products p ORDER BY b.created DESC";
$query = $this->getEntityManager()->createQuery($dql);
$query->setMaxResults($number);
return $query->getArrayResult();
}
public function getUsersIntervencao($userId, $number = 15) {
$dql = "SELECT b, e, r FROM Bug b JOIN b.engineer e JOIN b.reporter r ".
"WHERE b.status = 'OPEN' AND e.id = ?1 OR r.id = ?1 ORDER BY b.created DESC";
return $this->getEntityManager()->createQuery($dql) ->setParameter(1, $userId) ->setMaxResults($number) ->getResult();
}
public function getOpenIntervencaoByProduct() {
$dql = "SELECT p.id, p.name, count(b.id) AS openBugs FROM Bug b ".
"JOIN b.products p WHERE b.status = 'OPEN' GROUP BY p.id";
return $this->getEntityManager()->createQuery($dql)->getScalarResult();
}
}
And I wanted in IntervencaoController
call the parameters/variables.
Intervencao.php : namespace Roqsys Control Manutencaobundle Entity; Intervencaocontroller : namespace Roqsys Control Manutencaobundle Controller;
– Catarina Silvestre
I don’t know if you need any more, but if you do.
– Catarina Silvestre
I edited the answer. See if it works.
– Rodrigo Rigotti
why is the text edited?
– Catarina Silvestre
Because I put the namespaces you mentioned and also the repository entities in Controller.
– Rodrigo Rigotti