| Total Complexity | 5 | 
| Total Lines | 41 | 
| Duplicated Lines | 0 % | 
| Changes | 0 | ||
| 1 | <?php | ||
| 8 | class Manager | ||
| 9 | { | ||
| 10 | /** | ||
| 11 | * @var EntityManager | ||
| 12 | */ | ||
| 13 | static private $manager; | ||
| 14 | |||
| 15 | public static function get($isDevMode = true) | ||
| 16 |     { | ||
| 17 |         if (self::$manager) { | ||
| 18 | return self::$manager; | ||
| 19 | } | ||
| 20 | |||
| 21 | $ds = DIRECTORY_SEPARATOR; | ||
| 22 | $config = Setup::createAnnotationMetadataConfiguration([__DIR__.$ds.'Model'], $isDevMode); | ||
| 23 | $conn = array( | ||
| 24 | 'driver' => 'pdo_sqlite', | ||
| 25 | 'path' => __DIR__.$ds.'db.sqlite', | ||
| 26 | ); | ||
| 27 | |||
| 28 | return self::$manager = EntityManager::create($conn, $config); | ||
| 29 | } | ||
| 30 | |||
| 31 | /** | ||
| 32 | * @param $class | ||
| 33 | * | ||
| 34 | * @return \Doctrine\ORM\EntityRepository | ||
| 35 | */ | ||
| 36 | public static function getRepository($class) | ||
| 37 |     { | ||
| 38 | return self::get()->getRepository($class); | ||
| 39 | } | ||
| 40 | |||
| 41 | public static function persist($entity) | ||
| 44 | } | ||
| 45 | |||
| 46 | public static function flush($entity = null) | ||
| 49 | } | ||
| 50 | } | ||
| 51 |