Completed
Push — master ( 2a4552...89ca68 )
by Park Jong-Hun
03:06
created

EntityFinder   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 0
cbo 3
dl 0
loc 17
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A findById() 0 4 1
A findOneBy() 0 4 1
A findAll() 0 4 1
1
<?php
2
3
namespace Core\Utils;
4
5
use Core\DatabaseManager;
6
7
class EntityFinder
8
{
9
    public static function findById($entityName, $id)
10
    {
11
        return DatabaseManager::getEntityManager()->getRepository($entityName)->find($id);
12
    }
13
14
    public static function findOneBy($entityName, $criteria, $orderBy = [])
15
    {
16
        return DatabaseManager::getEntityManager()->getRepository($entityName)->findOneBy($criteria, $orderBy);
17
    }
18
19
    public static function findAll($entityName)
20
    {
21
        return DatabaseManager::getEntityManager()->getRepository($entityName)->findAll();
22
    }
23
}
24