2020-05-13 12:10:24 +00:00
|
|
|
<?php
|
|
|
|
|
2020-05-20 16:53:53 +00:00
|
|
|
// {{{ License
|
|
|
|
// This file is part of GNU social - https://www.gnu.org/software/social
|
|
|
|
//
|
|
|
|
// GNU social is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU Affero General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// GNU social is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU Affero General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Affero General Public License
|
|
|
|
// along with GNU social. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
// }}}
|
|
|
|
|
2020-05-13 12:10:24 +00:00
|
|
|
/**
|
|
|
|
* Doctrine entity manager static wrapper
|
|
|
|
*
|
|
|
|
* @package GNUsocial
|
|
|
|
* @category DB
|
|
|
|
*
|
|
|
|
* @author Hugo Sales <hugo@fc.up.pt>
|
|
|
|
* @copyright 2020 Free Software Foundation, Inc http://www.fsf.org
|
|
|
|
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
|
|
|
|
*/
|
|
|
|
|
2020-06-04 21:00:05 +00:00
|
|
|
namespace App\Core\DB;
|
2020-05-13 12:10:24 +00:00
|
|
|
|
2020-05-14 21:55:04 +00:00
|
|
|
use Doctrine\ORM\EntityManagerInterface;
|
2020-05-13 12:10:24 +00:00
|
|
|
|
|
|
|
abstract class DB
|
|
|
|
{
|
2020-05-14 21:55:04 +00:00
|
|
|
private static ?EntityManagerInterface $em;
|
|
|
|
public static function setManager($m): void
|
2020-05-13 12:10:24 +00:00
|
|
|
{
|
|
|
|
self::$em = $m;
|
|
|
|
}
|
|
|
|
|
2020-05-14 21:55:04 +00:00
|
|
|
public static function __callStatic(string $name, array $args)
|
2020-05-13 12:10:24 +00:00
|
|
|
{
|
2020-05-14 21:55:04 +00:00
|
|
|
return self::$em->{$name}(...$args);
|
2020-05-13 12:10:24 +00:00
|
|
|
}
|
|
|
|
}
|