Commit 0d187465dbf3cedbc1d8c71075f78efc7f2ddabe
1 parent
4bc36699
Exists in
master
and in
2 other branches
Adiciona restrição de unicidade ao campo host da impressora
Showing
4 changed files
with
14 additions
and
7 deletions
Show diff stats
Entity/Printer.php
Entity/PrinterCounterRepository.php
| ... | ... | @@ -32,10 +32,11 @@ class PrinterCounterRepository extends EntityRepository |
| 32 | 32 | printer.name, |
| 33 | 33 | printer.description, |
| 34 | 34 | printer.host |
| 35 | - FROM CocarBundle:PrinterCounter pc1 | |
| 36 | - INNER JOIN CocarBundle:Printer printer WITH pc1.printer = printer.id | |
| 37 | - INNER JOIN CocarBundle:PrinterCounter pc2 WITH (pc1.printer = pc2.printer AND pc2.date >= :start) | |
| 35 | + FROM CocarBundle:Printer printer | |
| 36 | + LEFT JOIN CocarBundle:PrinterCounter pc1 WITH pc1.printer = printer.id | |
| 37 | + LEFT JOIN CocarBundle:PrinterCounter pc2 WITH (pc1.printer = pc2.printer AND pc2.date >= :start) | |
| 38 | 38 | WHERE pc1.date <= :end |
| 39 | + OR pc1.date IS NULL | |
| 39 | 40 | GROUP BY printer.id, |
| 40 | 41 | pc1.blackInk, |
| 41 | 42 | pc1.coloredInk, |
| ... | ... | @@ -69,10 +70,11 @@ class PrinterCounterRepository extends EntityRepository |
| 69 | 70 | printer.name, |
| 70 | 71 | printer.host, |
| 71 | 72 | (max(pc1.prints) - min(pc2.prints)) as totalPrints |
| 72 | - FROM CocarBundle:PrinterCounter pc1 | |
| 73 | - INNER JOIN CocarBundle:Printer printer WITH pc1.printer = printer.id | |
| 74 | - INNER JOIN CocarBundle:PrinterCounter pc2 WITH (pc1.printer = pc2.printer AND pc2.date >= :start) | |
| 73 | + FROM CocarBundle:Printer printer | |
| 74 | + LEFT JOIN CocarBundle:PrinterCounter pc1 WITH pc1.printer = printer.id | |
| 75 | + LEFT JOIN CocarBundle:PrinterCounter pc2 WITH (pc1.printer = pc2.printer AND pc2.date >= :start) | |
| 75 | 76 | WHERE pc1.date <= :end |
| 77 | + OR pc1.date IS NULL | |
| 76 | 78 | GROUP BY printer.id, |
| 77 | 79 | printer.name, |
| 78 | 80 | printer.description, | ... | ... |
Resources/views/Printer/new.html.twig