These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Kunstmaan\DashboardBundle\Repository; |
||
4 | |||
5 | use Doctrine\ORM\EntityRepository; |
||
6 | |||
7 | /** |
||
8 | * AnalyticsSegmentRepository |
||
9 | * |
||
10 | * This class was generated by the Doctrine ORM. Add your own custom |
||
11 | * repository methods below. |
||
12 | */ |
||
13 | class AnalyticsSegmentRepository extends EntityRepository |
||
14 | { |
||
15 | /** |
||
16 | * Get a segment |
||
17 | * |
||
18 | * @param int $id |
||
19 | * |
||
20 | * @return AnalyticsOverview|bool |
||
21 | */ |
||
22 | public function deleteSegment($id) |
||
23 | { |
||
24 | $em = $this->getEntityManager(); |
||
25 | $qb = $em->createQueryBuilder(); |
||
26 | $qb->select('s') |
||
27 | ->from('KunstmaanDashboardBundle:AnalyticsSegment', 's') |
||
28 | ->where('s.id = :id') |
||
29 | ->setParameter('id', $id); |
||
30 | |||
31 | |||
32 | $results = $qb->getQuery()->getResult(); |
||
33 | if ($results) { |
||
34 | $em->remove($results[0]); |
||
35 | $em->flush(); |
||
36 | } |
||
37 | } |
||
38 | |||
39 | /** |
||
40 | * Initialise a segment by adding new overviews if they don't exist yet |
||
41 | * |
||
42 | * @param AnalyticsSegment $segment |
||
43 | * @param int $configId |
||
44 | */ |
||
45 | public function initSegment($segment, $configId = false) { |
||
46 | if (!count($segment->getOverviews()->toArray())) { |
||
47 | if ($configId) { |
||
0 ignored issues
–
show
|
|||
48 | $config =$this->getEntityManager()->getRepository('KunstmaanDashboardBundle:AnalyticsConfig')->find($configId); |
||
49 | } else { |
||
50 | $config =$this->getEntityManager()->getRepository('KunstmaanDashboardBundle:AnalyticsConfig')->findFirst(); |
||
51 | } |
||
52 | $this->getEntityManager()->getRepository('KunstmaanDashboardBundle:AnalyticsOverview')->addOverviews($config, $segment); |
||
53 | } |
||
54 | } |
||
55 | |||
56 | } |
||
57 |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
integer
values, zero is a special case, in particular the following results might be unexpected: